Reading list Switch to dark mode

    Resize image in magento

    Updated 2 March 2015

    Resize image in magento
    /*Existing Image Path*/
         $currentimagePath = Mage::getBaseDir('media') . DS . 'alice_banner'. DS . $value->getFilename();
    /*Resized Image Path*/     
         $rszImagePath = Mage::getBaseDir('media') . DS . 'alice_banner'. DS . 'cache' . DS .'1160x525' .DS. $value->getFilename();
         if (!file_exists($rszImagePath)) {
             $image = new Varien_Image($currentimagePath);
             $image->resize(1160, 525);
    /*Final Image*/
    <img src="<?php echo Mage::getBaseUrl('media') . DS . 'alice_banner'. DS . 'cache' . DS .'1160x525' .DS. $value->getFilename(); ?>"/>

    Searching for an experienced
    Magento Company ?
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • Ketan Chaudhari

    Varien_Image is not working in pthml file. I called one pthml file on Home page CMS and when I used this Varien_Image then home page content are not showking.

    Please suggest on this.

  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home