How to resize image in magento?
magento

How to resize image in magento?

KrikaSoft
14 Jul 2014 16:21

To resize image in magento use below code and pass image url as parameter in Varien_Image object.

/** Varien Image object for image url */
    $imageObj = new Varien_Image($imageUrl);
/** Set constrain */
    $imageObj->constrainOnly(true);
/** Keep Image Aspect ratio */
    $imageObj->keepAspectRatio(false);
/** Keep Image frame */
    $imageObj->keepFrame(false);
/** Keep Image Transparency */
    $imageObj->keepTransparency(true);
/** Set image background Color */
    $imageObj->setImageBackgroundColor(false);
/** Set background color */
    $imageObj->backgroundColor(false);
/** Set image quality */
    $imageObj->quality(100);
/** Set watermark Image Opacity */
    $imageObj->setWatermarkImageOpacity(0);
/** Set image size and */
    $imageObj->resize(182, 126);
/** Save image at given new file path */
    $imageObj->save($imageResized);

Author

KrikaSoft
Hello, I'm
KrikaSoft

KrikaSoft offers innovative IT solutions and services to businesses worldwide. Specializing in Web development, Web customization, and Website design, we excel in Magento, WordPress, and other PHP frameworks. From Hybrid Application Development to seamless user experiences, trust us as your technology partner for reliable and cutting-edge solutions. Experience excellence with KrikaSoft!

Latest Post