Need help buying now? +48-22-219-5163 +1-917-720-3250
My Cart

Your Cart is Empty

Need help buying now?
+48-22-219-5163 +1-917-720-3250

Image compensation in Magento

Image compensation in Magento

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

What it is

Image compensation is reducing of 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 Magento module to reduce the page loading 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 Magento 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 perfectly on a store page but, at the same time, they will be very heavy for 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 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 Magento releases 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. Please also read other articles in our blog and share the most interesting of them to your friends. You can also discuss this and other Magento related problems on Magento forum.

Newsletter