0

a graphic designer optimizes the images (products, galleries,...) for me, with good proportion of quality and compression,… and then Magento creates new images,… that are double size and not same quality. In example, 3 optimized images with sizes 392K, 428K, 281K, Magento create new ones to cache folder, and what I get at frontend are this new images: 642K, 738K, 504K.

So, my question is How can I solve this? It has no sense to have a graphic designer, and then Magento overwrite his work,...

Thank you.

1 Answer 1

0

Magento rebuild his own images cache with different image sizes.

This behaviour allows template designer to get product images in the format they need.

You have different options to workaround your problem:

Option 1: Change image quality

In your phtml files you will find something like this:

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(265) ?>" />

Just try modifying the default quality level with:

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->setQuality(95)->resize(265) ?>" />

Option 2: Directly show the original image file

<img src="<?php echo Mage::getSingleton('catalog/product_media_config')->getMediaUrl($_product->getImage()) ?>" />
4
  • Thank you for your answer, I'd like to show the original image, as it has been optimized by a graphic designer. Has it any disadvantage to directly show the original image, instead of the Magento chache rebuilded image? I want this when I show the gallery images of the product. So now I have this line, inside the foreach: $img_src=$this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); so, what I need to change to show the original image of the gallery? Sorry, but I'm new with Magento...
    – Pau
    Commented Feb 26, 2016 at 15:49
  • It depends on your template. I do not see any side effect. I just suggest you to avoid using original images for thumbnails. Commented Feb 26, 2016 at 15:54
  • So, just to confirm, with the foreach I have, this is correct?: foreach ($_product->getMediaGalleryImages() as $_image): $img_original = Mage::getSingleton('catalog/product_media_config')->getMediaUrl($_image->getFile());
    – Pau
    Commented Feb 27, 2016 at 0:11
  • AFAIK it should work. Commented Feb 27, 2016 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.