I found some interesting methods in the product model
/**
* Return re-sized image URL
*
* @deprecated since 1.1.5
* @return string
*/
public function getImageUrl()
{
return (string)$this->_getImageHelper()->init($this, 'image')->resize(265);
}
/**
* Return re-sized small image URL
*
* @deprecated since 1.1.5
* @param int $width
* @param int $height
* @return string
*/
public function getSmallImageUrl($width = 88, $height = 77)
{
return (string)$this->_getImageHelper()->init($this, 'small_image')->resize($width, $height);
}
There's also getThumbnailUrl()
which work in the same way as getSmallImageUrl()
Unfortunately, the @deprecated
doc comment does not say anything about a replacement, so I wonder what should be used instead.
The method is not used in the core and in Magento 1.9 the templates always instantiate the image helper directly.
However, I wonder why I should not use this shortcut and why it has been deprecated in the first place. I'm sure it won't be removed now, if it hasn't been since 1.1.5. getImageUrl()
might not be very useful because it resizes to a fixed value, but getSmallImageUrl()
and getThumbnailUrl()
take $width
and $height
parameters.