1

I am using magento-1.9.2 version, now I posted different size images (400 x 400)and (750 x 750) like that. How can I show these images in same size in frontend?

2 Answers 2

1

As per my understanding you want to show fixed height to both these images. If that is the case try this piece of code, for 400 height:-

<?php echo $this->helper('catalog/image')->init($_product, 'image')
->constrainOnly(TRUE)
->keepAspectRatio(TRUE)
->keepFrame(FALSE)
->resize(null,400)
?>
0
<?php

        $products = Mage::getModel('catalog/product')->load(1); //Product ID
        echo "<pre>";
        //print_r($products);
        echo $products->getImage();
        echo "<br>";
        echo $products->getSmallImage();
        echo "<br>";
        echo $products->getThumbnail();
        echo "<br>";
        echo Mage::helper('catalog/image')->init($products, 'small_image')->resize(163,100); // resize function is used to resize image
        echo "<br>";
        echo Mage::helper('catalog/image')->init($products, 'image')->resize(400,400);
    ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.