Last active
January 11, 2021 23:07
-
-
Save rsisco/6deeb3209ec9a396c859ca249a9ab5fa to your computer and use it in GitHub Desktop.
Magento 2 - Identify gallery image files missing from filesystem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u <user> -p <db> -h <host> -e "SELECT distinct case when value like '/%' then concat('.',value) else value end FROM catalog_product_entity_media_gallery" | awk '{print $1}' | xargs ls | grep "cannot access" |
BTW, just a note so I don't forget or someone else uses the snippet, it should be run under pub/media/catalog/product/
missing one folder.
BTW, just a note so I don't forget or someone else uses the snippet, it should be run under
pub/media/catalog/product/
missing one folder.
Thanks; I've updated the comment.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this command from within the Magento project's
pub/media/catalog/product
folder. Any image filenames listed are missing from the filesystem and could cause the image resize command within Magento to fail. The solution is to either replace the missing image file or delete its row from thecatalog_product_entity_media_gallery
table.