Dennis de Ruiter
Dennis de Ruiter

Reputation: 19

Delete all product images in magento

I uploaded a product image in magento but found out it was no good. So I deleted it and uploaded another image with the same name. Now I get a _1 after the name of the image. Of course this occurs when a image already exists.

Does anybody now how I can delete all product images?

Upvotes: 1

Views: 1741

Answers (4)

Philip Deatherage
Philip Deatherage

Reputation: 190

You need to remove them in two places to avoid errors. Note, the following will remove ALL images from all your products. Please backup before.

First, you need to remove them from the database. You can do this by issuing the following in phpMyAdmin or however you choose:

TRUNCATE TABLE `catalog_product_entity_media_gallery`
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`

Second, remove your media/catalog folder. With SSH, you would use:

rm -rf media/catalog
rm -rf media/tmp
rm -rf media/import (if you used an import process for your images with your products).

Upvotes: 1

Dennis de Ruiter
Dennis de Ruiter

Reputation: 19

Remove the file from

  1. media/catalog/product/
  2. media/tmp/catalog/product/
  3. clear cache

Upvotes: 0

Try this extension http://www.magentocommerce.com/magento-connect/image-clean.html

On sites with large product count it work slowly, but you can delete images from hard disk (those images, that have been deleted in Magento).

Upvotes: 0

Lanius
Lanius

Reputation: 106

Well, if you want to get rid of the image files for products, you need to go to your server (by ssh / ftp or some cPanel) and delete all contents of /media/catalog/product. Using ssh you should do this that way:

ssh login@host [-p {port} # only if it's not 22 which is default, often it's also 2222 or 2223]
cd /path/to/your/magento/root
rm -rf /media/catalog/product/*

But have in mind that it will delete ALL product images in your Magento instance and may cause errors if some of this files are set as your current product images.

Upvotes: 1

Related Questions