Today I imported a couple of new products with uRapidFlow in Magento 2.1.2. I ran the import with the option Action on missing image file which was set to WARNING and update image field. It worked fine, but I accidentally forgot to upload the product images.
So basically uRapidFlow added non-existing product images to the database which broke the product edit form in the admin panel.
1 |
Cannot gather stats! Warning!stat(): stat failed for /var/www/src/pub/media/catalog/product/A_217823.JPG |
The temporarily solution was to manipulate ./vendor/magento/module-catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php in vendor around line 142,143.
1 2 3 4 5 |
if (is_readable($this->_mediaConfig->getMediaPath($image['file']))) { $fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file'])); $image['size'] = $fileHandler['size']; } |
I basically added is_readable to check if the file exists. Not great, but at least I was able to edit products again and proceed with a permanent fix.
Related issues:
https://github.com/magento/magento2/issues/5497