Resize image in block view
Permalink
Right now, I am displaying an image in my blocks view.php using the following code:I want to use the getThumbnail() function on this image to automatically resize the image - how can I go about doing that?
<img src=\"" . $controller->getFileObject()->getURL() . "\" alt=\"\">
Try this
$ih = Loader::helper('image'); $fo = $controller->getFileObject(); $filepath = $fo->getRelativePath(); $thumbnail = $ih->getThumbnail($fo,thumbnailWidth,thumbnailHeight); <img src="<?php echo $thumbnail->src;?>" alt="<?php echo $controller->altText; ?>"/>