Andy Simpson
Andy Simpson

Reputation: 43

Delete all Magento Images and Replace

I have a magento Installation which has had several image imports done by the client and its got wrong images in the wrong products, toasters with fridge freezers as the initial import had the wrong img names. After a further import via CSV it seems to have appended the images rather than change them.

I need to delete all product images on the site, then re-do the CORRECT import so all the images are correct.

Is there a quick way to delete all images then do a fresh import via Dataflow Profiles and re-map the correct fields?

Any help would be awesome!

Thanks in advance.

Upvotes: 1

Views: 1867

Answers (2)

hatef
hatef

Reputation: 6199

First:

DELETE * FROM catalog_product_entity_varchar WHERE attribute_id IN (x, y, z)

  • x = image
  • y = small_image
  • z = thumbnail

(you can find them in eav_attribute table)

Then:

Truncate these 2 tables:

catalog_product_entity_media_gallery
catalog_product_entity_media_gallery_value

Delete all photos in: '/media/catalog/product'

Clear cache.

Upload your fresh photos.

Upvotes: 0

Fran Mayers
Fran Mayers

Reputation: 396

How to delete all your image associations:

Go to your database and run the following:

DELETE FROM `catalog_product_entity_media_gallery`;

(Note this won't delete the actual files on the server. For this, you will also need to go to /media and run rm -rf catalog/product/)

Then you can re-run your import.

When completed, you will need to go to System > Cache Management and flush Catalog Images cache

Upvotes: 1

Related Questions