Webkul
Services
Technologies Bagisto QloApps
iOS Android SAP BigCommerce Wix
Trusted by
Samsung Intel Toyota Walmart Disney Nokia Nestlé Decathlon
See all customers
Back to Top
DOC

Resize image in magento

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(); ?>"/>
. . .

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