Resize image in block view

Permalink
Right now, I am displaying an image in my blocks view.php using the following code:
<img src=\"" . $controller->getFileObject()->getURL() . "\" alt=\"\">
I want to use the getThumbnail() function on this image to automatically resize the image - how can I go about doing that?

hursey013
 
SVijay replied on at Permalink Best Answer Reply
SVijay
Hi,

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; ?>"/>
hursey013 replied on at Permalink Reply
hursey013
Beautiful that did it. I swore I tried using that same snippet, but I must have been missing something. Thanks for the help.