magento resize product image

magento provide a way to resize the product image . you can simple use product object to resize product image .

<?php

$width = 150;
$height = 100;

 echo Mage::helper('catalog/image')->init($_product, 'image')->resize($width,$height);
// it will give main image name and it resize image 150X100 px.

if you want same height and width image uset this

 echo Mage::helper('catalog/image')->init($_product, 'image')->resize($width);
?>

// image with same height and width.

<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'image')->resize($width);?>"/> // for display image

If you want resize image programmatically or custom see
http://magentoo.blogspot.com/2014/01/magento-resize-category-image.html.

No comments:

Post a Comment