Receive getimagesize() error when resizing images

Hi Craig,

Received following error when running this command. Please let me know if you have a solution.

Command: bin/magento catalog:images:resize

Notice: getimagesize(): Read error! in /var/www/public/vendor/magento/module-catalog/Model/Product/Image.php on line 420

Thank you
Kevin

Hi @kevin0320 and welcome.

In order to provide the best possible answers, can you tell us:

  • What version of Magento you’re using?
  • Does this error get displayed immediately or after some time?
  • Do you use any 3rd party extensions to manage your images?

Hi Craig,

Magento 2.2.3.
Using. JustBetter -image optimizer extensión and also cloudflare.

Thank you
Kev

This isn’t an issue that I’ve ever come across before, but I did find a similar issue reported on the Magento 2 GitHub Repo from 2017.

It looks like someone was using a 3rd party extension that had created some broken images (specifically 0kb files). When the bin/magento catalog:images:resize command was run, it would Error out when it tried to resize the broken images.

At this point, I would check 2 things in the pub/media folder:

  1. Check that file Ownership and Permissions are correct, in case it’s a permissions issue (i.e. the files can’t be read/written by the command)
  2. Check if you have any odd looking files (e.g. 0kb)