Hello. Faced a problem in OpenCart 2. There is an image, say, 1000x1000 in jpg. Before uploading to the store, I optimize this image, reducing about 70% of its original weight. In the store, this image sprinkles up to 900x900 (suppose), but, paradoxically, it weighs a little more than an optimized 1000 by 1000 before loading. Given the fact that the image library (the default in OpenCart) is image quality 90.

Actually the question is what can be undertaken so that the images do not increase in weight after the crop? Because of this, the page sometimes weighs 100-150 kb more than it could. Thank you in advance!

  • Thanks for the tip-off, although I still don’t understand how the image I have already optimized can be inflated)) - Titorovich

1 answer 1

Size jumps due to the use of various image compression methods used by your regular compressors and opencart. Which, in 99% of cases, uses Imagick (Image Magick) because This is a standard image handler for all sorts of inexpensive vps. You can play with the quality (and correspondingly with the size) of the images in the catalog/model/tool/image.php . there find the line $image->save(DIR_IMAGE . $new_image); and add to the save method a second integer argument that will be equal to the quality of the image (from 0 to 100). By default, it seems there is 90, but maybe more in your template.