Back to Top

Resize image in magento

Updated 2 March 2015

Resize image in magento
<?php  
/*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);
         $image->save($rszImagePath);
     }
?>
/*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*


1 comments

  • Ketan Chaudhari
  • Back to Top

    Message Sent!

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

    Back to Home