Merchant Stories

Magento Image Compensation: How It Works With StoreFronts

Dec 3, 2014 2 min read 372 views
Listen audio
Magento Image Compensation: How It Works With StoreFronts

Magento ® is a unique platform for online store creations. Most of its functions are directed to improve the site ranking and attract users’ attention but some of them can significantly influence store sales. One such functions involve image compensation in Magento ®.

What is Magento image compensation

Image compensation is reducing its size (weight) at the expense of some lowering of the image quality or decreasing its parameters (side proportions). Naturally, web developers aimed at creating a system that would automatically distinguish ‘heavy’ images and they used a special module for Magento ® to reduce the page load time. But this is only one side of the coin, as this method has its disadvantages.

The main function of that module is modification of an image. At first sight, everything is great. But such compensation negatively influences images quality. They got corrupted, and if there is a text on the image it becomes unreadable.

How to disable compensation

Of course, if the quality of product images is not critical for your online store then this function can help you in the store promotion. But, if you sell products which should be viewed on a picture carefully by a customer before buying, e.g. gift cards or clothes, then you need to disable image compensation in Magento ®.

In order to do that, you can ask our development team for assistance, or try to do it on your own following the instructions below. First, find the file Gd2.php which is located at lib/Varien/Image/Adapter. Now, use ctrl+F to locate the following line in the file:

//call_user_func($this->_getCallback('output'), $this->_imageHandler, $fileName);

 

 

It should be replaced with the following code:

 
if ($this->_fileType === IMAGETYPE_JPEG) {
call_user_func($this->_getCallback('output'), $this->_imageHandler, $fileName, 99); 
} else {
call_user_func($this->_getCallback('output'), $this->_imageHandler, $fileName); 
}

 

 

Pay attention that ‘99’ corresponds to the maximum image quality. Images with such parameter will look perfect on a store page but, at the same time, they will be very heavy load. Some search systems will not like that, especially Google. If you do not wish to remove that line to be able to reverse the action, just comment it out using a double slash “//”.

Once those actions are done you need to go to the admin panel and flush the store cache. It is also recommended to clean your browser history and make sure that image cache is also cleaned. Go to Cache Management – Images Cache to do that. Now check the result of your work – just upload a high-quality image to your online store which would previously have been compensated to the certain size.

There is another way which is considered to be less efficient but simpler. You just need to save the images as ‘web Image’ in Photoshop before uploading them to your store. This helps to reduce the image weight with minimal effect on its quality. Of course, there is no guarantee that the system will not try to compensate that image, too, but it is worth trying.

This instruction is suitable for releases of Magento ® higher than 1.2, but remember that you will need to rewrite the part of code mentioned above after each system upgrade. If you have any questions, please email us directly or leave your comments below.

That's where you contact us!

    By submitting this form you agree to GoMage's Terms of Use and Privacy Policy
    woo-hoo! Now its time to keep checking your inbox, as we will be getting in touch soon. Promise :)
    oops! Thanks. But it seems like some kind of technical issues stop you from meeting GOMAGE. Could you try again?