Remove Uploaded Thumbnails

[color=#282828][font=arial, verdana, tahoma, sans-serif]Over time I had manually uploaded thumbnails on the product detail page in the admin (via csv). [/font][/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]Now I want to remove those and have the cart regenerate thumbs from the main image[/font][/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]However I cannot visit product pages one by one in the admin area to remove the uploaded thumbs. Is there a way to do it via CSV or any other way[/font][/color]



[color=#282828][font=arial, verdana, tahoma, sans-serif]Appreciate any advice[/font][/color]

You can add the following code to the index.php file:

$_image_data = db_get_array("SELECT * FROM ?:images_links WHERE object_type = 'product' AND image_id != 0");
foreach ($_image_data as $d) {
    fn_delete_image($d['image_id'], $d['pair_id']);
}

after this line:

require(dirname(__FILE__) . '/init.php');

Save the file and go to the home page. And do not forget to delete the code then

Thanks eCom, appreciate your help



This will work for 4.3.1 right? Thats my current version



Also is there any risk of deleting the detailed image? Should I backup anything?



There are about 8000 products where I want to delete the uploaded thumbnail images



Thanks again

[quote name='sap' timestamp='1434964679' post='219876']

Thanks eCom, appreciate your help



This will work for 4.3.1 right? Thats my current version



Also is there any risk of deleting the detailed image? Should I backup anything?



There are about 8000 products where I want to delete the uploaded thumbnail images



Thanks again

[/quote]



I also noticed that there are images for which detailed_id is = 0, these include (object_type = ) a few products, promo images, logo etc



For object_type = product, I will first upload the main image and then run the script you have suggested



For other object_types do I need to do anything?

Yes, it will work on your version. The “image_id != 0” condition means thumbnails only. If you are in doubt, make full dump (it is allowed from the admin panel)