I'm trying to understand how M2 handle images of deleted products. If I delete a product (by admin or import/delete), all associated images in the
media/catalog/product folder are still here.
After many reading, I found this Magento 2, How to delete unused images using PHP script. The solution seems to use the
php bin/magento eav:media:remove-unused command of magento-hackathon/EAVCleaner but still only 1 image found (same that the previous extension).
I try a script on my own who scan the
catalog_product_entity_media_gallery table, then scan the
media/catalog/product folder to look for the difference but there is not. After digging into the database, I just realize that M2 keep records of old deleted product images in the DB.
Question is: how do you manage disk usage with all these useless images ?? My store has almost 4 collections/year and around 11.000 products to change... in only 6 months
media/catalog/product folder size is around 6GB (without the cache) and still growing.
PS: I'm on a 2.1.9 version