Magento Admin Tool to Remove All Product Images

Is there an admin tool in Magento that removes all images from all products? I know that you can go through the product and delete all the images, but I wonder if there is an admin tool that will do all the products at the same time?

Thanks in advance.

+4
source share
3 answers

I'm not sure why you would like to do this, but here is a way to do it directly from the database.

  • Then the backup trims these 2 tables:

    catalog_product_entity_media_gallery catalog_product_entity_media_gallery_value

  • then delete '/ media / catalog / product'

  • clear all caches.

I have not tested it, but it should do the job. If it does not work, restore these 2 tables

+11
source

This method has been tested and works. One of the reasons you want to do this is when you are testing Dataflow Import for products. When you specify images in a download, Magento only adds images - it does not replace or delete them.

The end result is that multiple profile runs will accumulate the amount of redundant images.

mysql> **truncate catalog_product_entity_media_gallery;** mysql> **truncate catalog_product_entity_media_gallery_value;** 

Then from the command line of your Magento media / directory folder:

 media/catalog$ **rm -rf ./product/** 
+3
source

It is a bad idea to do this through a DB, but if you must:

 ALTER TABLE `catalog_product_entity_media_gallery_value` DROP FOREIGN KEY `FK_CAT_PRD_ENTT_MDA_GLR_VAL_STORE_ID_CORE_STORE_STORE_ID`, DROP FOREIGN KEY `FK_CAT_PRD_ENTT_MDA_GLR_VAL_VAL_ID_CAT_PRD_ENTT_MDA_GLR_VAL_ID`; TRUNCATE `catalog_product_entity_media_gallery_value`; TRUNCATE `catalog_product_entity_media_gallery`; ALTER TABLE `catalog_product_entity_media_gallery_value` ADD CONSTRAINT `FK_CAT_PRD_ENTT_MDA_GLR_VAL_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `FK_CAT_PRD_ENTT_MDA_GLR_VAL_VAL_ID_CAT_PRD_ENTT_MDA_GLR_VAL_ID` FOREIGN KEY (`value_id`) REFERENCES `catalog_product_entity_media_gallery` (`value_id`) ON DELETE CASCADE ON UPDATE CASCADE; 

Then you can delete the product folders:

 cd media/catalog/product rm -rf * 
+2
source

Source: https://habr.com/ru/post/1414265/


All Articles