Magento Image Resizing – Fix Different Height and Width Values Issue

image resizingmagento-1.9product-images

I am trying below code to resize height and width of image. If i give resize(350 ,250) instead of resizing , its displaying image 350px away from left and 250px away from top from its original position.

If i give same value for both height and width [ resize(250 ,250) ] , than only resize will work properly.

<?php $imageUrl = Mage::helper('catalog/image')->init($_product, 'image')->resize(250 ,250)->setQuality(100); ?>

Update

Issue is if we resize the Image with Different height & Width , than its adding background image to Product image.

1) resize(150 ,750) Image with differnet height and width: link

2) resize(750, 750) Image with same height and width: link2

Best Answer

You can resize image Height or Width by use below code

<?php $imageUrl = Mage::helper('catalog/image')->init($_product, 'image')->keepFrame(true)->resize(350 ,250)->setQuality(100); ?>
Related Topic