by
tim » Mon Aug 01, 2016 7:55 pm
The documentation describes some of the limitations of the <cms:exif> tag. Instead, here's a custom tag for easily outputting the width and height of any image.
You can add this snippet of code to
kfunctions.php in the
couch/addons folder.
- Code: Select all
class CustomTags{
static function image_size( $params, $node ){
if( count($node->children) ) {die("ERROR: Tag \"".$node->name."\" is a self closing tag");}
$image = trim( $params[0]['rhs'] );
$size = getimagesize($image);
$dimensions = $size[3];
return $dimensions;
}
}
$FUNCS->register_tag( 'image_size', array('CustomTags', 'image_size') );
Usage- Code: Select all
<img src="<cms:show my_imagethumb />" <cms:image_size my_imagethumb /> alt="" />
The tag could be modified if you wanted to do something else with the width and height of the image.