Delete all product images from Magento store

It all boils down to:

1. Nuking the database

In your mariadb instance, execute

truncate catalog_product_entity_media_gallery_value;
truncate catalog_product_entity_media_gallery_value_to_entity;
delete from catalog_product_entity_media_gallery;
delete from catalog_product_entity_varchar where attribute_id in ( select 
     attribute_id from eav_attribute where attribute_code IN ( 'image', 'small_image', 'thumbnail', 'swatch_image', 'media_gallery' ) AND entity_type_id = 4 );

2. Nuking the media folder

In your Magento instance, execute

rm -rf pub/media/catalog/product

There, clean slate for you to populate.

Never see. Never know.

Leave a Comment

Your email address will not be published. Required fields are marked *