Jump to content

Why does prestashop increase the image size?


Recommended Posts

Everytime I upload an image either via the back office or through the import feature, Prestashop adds anywhere from 30 KB to 50 KB on my picture size. It doesn't matter if the format is .gif or .jpg, it does it regardless. And It doesn't matter what size I upload neither. I can upload an image that matches the thickbox size as set in the preferences > images, is smaller, or larger, it doesn't matter. Does this happen to anyone else? How do I fix it? I have product pictures that are like 100 KB even though their actual size is like 20 KB!!

Link to comment
Share on other sites

  • 4 months later...

You could try reducing the quality of the JPEGs generated in images.inc.php on line 235:

$flag = imagejpeg($ressource, $filename, 90);



and line 40:

imagejpeg($newImage, _PS_TMP_IMG_DIR_.$cacheImage, 86);



It seems that by default, the JPEG is generated at 90% quality and cached at 86% quality. If you are saving your JPEGs at a lower percent quality, you could try lowering these values.

Link to comment
Share on other sites

Thank you Rocky, It works perfectly.

line 235, I changed the percentage from 90 to 70.
line 40, I lowered the number to 66 (just a little bit less than the above number, I guess).

The quality of the image generated by PS is acceptable.

Link to comment
Share on other sites

  • 2 years later...

Hello, Prestashop has a serious problem, to see what I mean well, do an image either to a product, category, etc ... reduces any such program smush.it example: 100k reduced weigh my image with 60k and now weighs smush.it once again rise to 100k or prestashop weighs much more, my conclusion is that to generate the images prestashop recreates coded garbage and that's why I do not respect theweight of the image that is uploaded, the solution is trying to implement a way to make up the image as it has been prepared, ie if the compressed image I to 60kwith Smush. debri prestashop it up and cut only the images without changing the quality or the but of images.

 

If you search on google, you will see that there is a wordpress plugin smush.it that the operation is as follows, an image rises but before being uploaded that image has been compressed by smushit and stored with the minimum weight available, not talking about quality, simply clean the garbage code that are created in the images when using any bar program editing and imaging, greetings.

Link to comment
Share on other sites

×
×
  • Create New...