csimmons222 Posted August 29, 2015 Share Posted August 29, 2015 I uploaded thousands of products via a CSV file in a mass import. For the CSV import, many of the products noted to have multiple images associated with them. The reality is that most of these products only had one image. This has left me with A LOT of my products showing one product image and then the question mark image for all of the other "missing images" on the frontend. Is there a way for me delete all "missing images" associated with a product for all products in mass? It would take me forever to go into each and every product individually and manually delete the question mark images. Link to comment Share on other sites More sharing options...
gabdara Posted August 30, 2015 Share Posted August 30, 2015 If you want to keep only the cover image of products in database you can use this SQL query: DELETE FROM `ps_image` WHERE `cover` IS NULL Link to comment Share on other sites More sharing options...
csimmons222 Posted August 30, 2015 Author Share Posted August 30, 2015 Thank you for the help! Unfortunately, with some of the products...I only want to keep the cover photo. However, on many of the products there are two or three legit photos that need to stay. Therefore, I was hoping that there was a way to determine only the pictures that don't have URLs (the question mark images) and removed those. Link to comment Share on other sites More sharing options...
gabdara Posted August 30, 2015 Share Posted August 30, 2015 Then take this a little bit further and create a php script in which you select all the image ids from your store, use Image::getAllImages(). For every image id instantiate the class Image and test if file_exists(_PS_PROD_IMG_DIR_.$this->getImgFolder()), if the image doesn't exists use function delete() of class Image. Link to comment Share on other sites More sharing options...
csimmons222 Posted September 5, 2015 Author Share Posted September 5, 2015 Then take this a little bit further and create a php script in which you select all the image ids from your store, use Image::getAllImages(). For every image id instantiate the class Image and test if file_exists(_PS_PROD_IMG_DIR_.$this->getImgFolder()), if the image doesn't exists use function delete() of class Image. I appreciate you taking the time to comment and help. Unfortunately, I do not know php all that well to be able to write the script myself. Link to comment Share on other sites More sharing options...
susieb Posted February 28, 2016 Share Posted February 28, 2016 Hi - I need to delete all the product images from the site and start again as everytime I have uploaded a csv file is has regenerated a product image and I can't find a way to change this in bulk. I'm also getting an error 404 when I regenerate thumbnails. Can you talk me through step by step how to do this? it looks like it could be similar to the solution above. Can you help? thanks in advance - Susie ( beginner with little knowledge sadly) Link to comment Share on other sites More sharing options...
Recommended Posts