Description
PrestaShop image cleaner deletes unused/redundant images from your site to free up disk space.
Why there are ununsed/redundant images?
Here are some cases in which images may become ununsed/redundant:
- Deleting image types on the "BO > Design > Image Settings" page. When you delete a image type, its thumbnails won't be deleted, they will only be deleted when regenerate all thumbnails, but some people never regenerate all thumbnails.
- Deleting products via a SQL or a tool or a module. If you deleted a product from back office, then images will be deleted automatically, but if you use another way to delete a product, then the product's images may not get deleted.
- High resolution images. If the "Generate high resolution images" setting on the "BO > Design > Image Settings" page is enabled, then a 2x image will be generated for every image type of every product image. 2x images may become redundant when the setting is disabled.
- Watermark module. If the "Logged in customers see images without watermark" setting in the watermark is enabled, then extra images will be created, those images may become redundant.
- Webp module. Webp modules generates .webp images for every image type of every product image in the /img/p/ folder, those .webp images may become redundant.
What images can be cleaned up?
This image cleaner module will check all product images, category images, manufacturer images, supplier images, store images and images in the /img/tmp/ folder.
- Thumbnails of deleted image types.
- Thumbnails of deleted languages.
- Thumbnails of deleted images.
- Useless thumbnails generated by the watermark module.
- None image files.
- Others, like images uploaded via FTP.
NOTE this image cleaner module scans images in the /img/ folder, all images in the /img/ folder are managed by PrestaShop, don't use FTP to upload any files to the /img/ folder.
How this module tell a image is redundant ?
This image cleaner module scans images in the /img/ folder to get a list of all images, and then it checks your site's database to get another list which contains images which are in use. This image cleaner module compares these two lists to get a list of all redundant images. So all images which are in used by PrestaShop are safe, this image cleaner module won't delete them.
Compatibility.
- PrestaShop 1.6.
- PrestaShop 1.7.
- All themes.
How to install and upgrade.
The "PrestaShop image cleaner" can be installed easily without editing any files.
How to install? Use the "Upload a module" button on "BO > Modules" page to install the module.
How to upgrade? Use the "Upload a module" button on "BO > Modules" page to upload the new version to your site, it's the same as how to install, don't worry all your data will be safe, PrestaShop will just upload updated files to your site, it won't reinstall this module.
How to get support.
If you have any questions with this module, post them out on the PrestaShop module support forum, we'll help you out.
Documentation.
The scan process does need quite a while to scan all images in the /img/ folder. The more images you have, the longer it takes, in some cases, it may take hours to finish. During the scan process, please keep the Image cleaner page be open.
Let's talk about the "Erase previous images" option on the "BO > Design > Image Settings" page. When the "Erase previous images" option is enabled and you generate thumbnails for one specific image type, then only thumbnails of the specific image type will be deleted. If you generate thumbnails for all image types, then all thumbnails generated by PrestaShop will be deleted, thumbnails generated by 3rd party modules (like a webp module) won't be deleted.
For a site which has a lot of images, time-out errors or 500 errors may happen when using the native thumbnail generation feature, that's why some people never use the feature, which leads to having a lot of redundant images.
All images in the /img/ folder are managed by PrestaShop, don't upload anything to the folder. Manually uploaded images will be considered as redundant ones, they will be listed out for you to decide whether to delete them. If you want to manually upload some images to your site, upload them to the /upload/ folder.
Although the name of this folder contains "tmp", but actually some images in it are not tmp ones. Some images in the /img/tmp/ folder are used in the back office, they shouldn't be deleted.
My case: Old Prestashop store with more than 6 years, 900+ products with a lot of images each one, a lot of updates, modules, problems, bugs (all solved)... I started to have storage space problems with my hosting. Bought the module, installed in 1 minute, scanned all images in the shop in about 3 minutes and..... I had 2,1 Gb in obsolete product photos that was only occuping space. A nice feature is that you can see the scanned photos before delete them. Nice module, I used it only 5 minutes but it was worth it.