0

For some reason, the image gallery for certain products isn't resizing its main image, but other products are doing it fine. Here's an example of a product that isn't working. Here's an example of one that is. As you can see, the images themselves are the same size, but one is being sized to ~800px, and the other to ~300px. Both have inline styling, but I can't figure out where this styling is coming from.

It's just using the default Fotorama Slider. I've attempted to add various maxwidth, max-width, maxheight, and max-height attributes to various places:

  • x-magento-init block in app/design/frontend/<theme>/Magento_Catalog/templates/product/view/gallery.phtml
  • vendor/magento/theme-frontend-luma/etc/view.xml
  • vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml

No dice - I can get changes to appear on the frontend, but nothing I do fixes the image sizes.

1

I've tried to do this comand:

php bin/magento catalog:images:resize

And i had this error:

Warning: imagecreatetruecolor(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully

@MaxL can you help please?

  • It seems that you have at least 1 image that is extremely large that is causing the 4GB memory limit to be exceeded – MaxL May 4 '17 at 15:35
0

Try running the following command in the CLI from your Magento installation's root folder:

php bin/magento catalog:images:resize  

It might help!

  • That didn't seem to do anything. I ran the command then cleared the image cache, and some product images are still too large while others are fine. I did receive quite a few of this error: libpng warning: Incorrect sBIT chunk length - could that have preventing some images from resizing? – A Decker May 4 '17 at 14:55
  • You might have some corrupted png files, try re-saving those images in a different format like jpg and re-uploading them? – MaxL May 4 '17 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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