Magento’s Image Resize Functionality

1) Resize functionality in Magento.Here is what the default image resize code looks like:

<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(420) ?>

2) Here is what your image code would look like with all these set:

<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)->resize(350, null) ?>


3) constrainOnly(true) This will not resize an image that is smaller than the dimensions inside the resize() part.

4) keepAspectRatio(true) This will not distort the height/width of the image.

5) keepFrame(false) This will not put a white frame around your image.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s