Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Change Image Compression in Version 1.3.1
 
jackberry
Jr. Member
 
Total Posts:  4
Joined:  2009-05-14
 

Hi there,

First time post! OK, so, does anyone know how I can change the image compression rate in Magento 1.3.1? I’ve read this thread (Avoid image compression with GD2): http://www.magentocommerce.com/boards/viewthread/6158/P0/, and searched far and wide to find two suggestions:

1. Edit /lib/Varien/Image/Adapter/Gd2.php

Find “call_user_func($this->_getCallback(’output’), $this->_imageHandler, $fileName);”
Replace with “if (IMAGETYPE_JPEG === $this->_fileType)call_user_func($this->_getCallback(’output’), $this->_imageHandler, $fileName,100);
else
call_user_func($this->_getCallback(’output’), $this->_imageHandler, $fileName);”

Thing is, Gd2.php must have changed between versions (there’s some reference to improved image compression in the change log for version 1.3.1) and so the syntax in my Gd2.php isn’t quite the same. The closest statement I can find in my Gd2.php is

“$this->_imageHandler = call_user_func($this->_getCallback(’create’), $this->_fileName);”

Changing this to “$this->_imageHandler = call_user_func($this->_getCallback(’create’), $this->_fileName), 95;” breaks images on product pages, they don’t display. Damn it! :-(

2. Edit /app/code/core/Mage/Media/Model/File/Image.php

Change “$result = imagejpeg($object->getTmpImage(), $object->getFilePath(true), 80);”

to “$result = imagejpeg($object->getTmpImage(), $object->getFilePath(true), 95);”

I’ve done this, deleted an image, uploaded it again, cleared the image cache and there’s no noticeable difference in quality.

Any suggestions anyone? It would be nice to have good quality images on product listings to give my site that extra crispness. Your assistance would be mucho appreciated. grin

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top