Skip to content

catalog:images:resize = getimagesize(): Read error! in vendor/magento/module-catalog/Model/Product/Image.php on line 410 if an image is 0 bytes #8204

@spyrule

Description

@spyrule

When I attempt to execute:
php bin\magento catalog:images:resize

After a period of time, I receive this error:

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

However, no report is pushed into any log file, so there is no way to find out the file causing the read error.

After some digging I realized its due to images that have a zero byte size (I use a 3rd party image upload tool that will upload zero byte files (ticket is open with them as well)

Luckily, I upload all of my files from a single image directory, so I was able to identify the offending file, but many won't be this lucky.

Preconditions

  1. Magento 2.1.3
  2. PHP 7
  3. nginx - hosted server

Steps to reproduce

  1. Upload a file into a product, make sure its a zero byte file, and make it the image/thumbnail/small reference.
  2. go to the command line, and execute php bin\magento catalog:images:resize
  3. after a period of time, the above error will appear.

Expected result

  1. It should just skip the offending file, and/or update the log file to indicate which/where the problematic file resides.

Metadata

Metadata

Labels

Component: CatalogFixed in 2.2.xThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions