How to Remove/Delete Unused Images in Magento 2
Is your Magento 2 store occupied with plenty of redundant images of the products that you have deleted? Are you looking for a solution to find and delete duplicate images in Magento 2?
If so, then this blog post might help you! as it falls in Magento website maintenance tips that will help you boost your store.
In this post, I will provide you with a complete guide to perform an image clean-up of your Magento store. It is all about how you can delete unused images in Magento 2.
Images are some of the most convenient ways to showcase your products to customers. They help make your online store more attractive and informative to allure the customers to purchase the products. Yet, in worst cases, they may turn into one of the common reasons behind the poor performance of your online store.
Table of Contents
Storing a large number of image files can slow down the server and thus can affect the overall store experience. There can also be plenty of images on your Magento 2 server of the products that you have deleted, which are no longer used. Such redundant and unnecessary images can slow down the server response of your online store and can affect its overall performance.
Removing the unused images from Magento 2 can clean up the storage and help improve the store performance. Here is the complete solution to do that.
A Solution to Remove/Delete Unused Images in Magento 2
Magento 2 allows the store owners to remove or delete the products as and when required. However, the images associated with those products are not automatically removed and can occupy unnecessary space. Also, there is no default functionality to remove unused product images in Magento 2.
In order to remove redundant product images from your store, you can use Magento 2 Image Clean extension by Meetanshi. The extension makes it easier to find and delete unused images in Magento 2.
The extension supports removing the duplicate images in the store through a single click. Moreover, it supports removing duplicate product and category images from Magento 2 individually through a separate grid that lists all the used and unused images. Admin can also automate scheduled unused image deletion in Magento 2 using this extension.
Install the Magento 2 Image Clean extension and use the solution provided here to find and delete unused images in Magento 2.
Manually Remove or Delete Unused Images in Magento 2
Once the extension is successfully installed on your store, head towards Image Clean > Configuration and configure the following settings:
- Clean Resources: Select the image resources that you want to clean. You can select the following options to clean the unused images in Magento 2:
- Unused Category Images
- Unused Product Images
- Maximum Images to Process in Each Attempt: Enter the maximum number of unused images to be deleted or removed at once.
- Manual Cleanup: You can use this option to remove/delete all the unused images from your Magento 2 store through a single click as per the configuration.
Schedule Periodic Removal of Duplicate Product Images in Magento 2
The Magento 2 Image clean extension also supports scheduling automated duplicate images removal. You can enable the schedule periodic removal of unused images from the backend and configure the following:
-
- Cleanup Frequency: Set the automatic image cleanup frequency in your Magento 2 store.
- Start Time: Select the starting time for the periodic cleanup.
Once the schedule periodic cleanup is enabled, the extension performs an automatic removal and deletion of the unused images from the Magento 2 periodically as per the configuration.
You can enable this option if you often add and removes products in your online store. This helps you to ensure that no redundant images of the deleted products are left in your store.
Find & Remove Unused Product Images in Magento 2
The Magento 2 Image Clean extension also facilitates the admin to fetch a list of the unused images in Magento 2 and delete them individually. To clean unused product images in Magento 2, go to Image Clean > Unused Product Images.
The backend grid – ‘Unused Product Images’ lists all the product images in the Magento 2 store that are not being used by any of the products. You can fetch or update the image list by clicking on the button provided on the top-right-hand side of the page.
The grid supports deleting the images individually or selecting multiple images for bulk deletion.
In the same way, the extension also supports deleting category-wise unused images in Magento 2. The same can be accessed through the grid provided at Image Clean > Unused Category Images.
Delete Unused Images in Magento 2 via SSH
The amazing features of this extension do not end here. Apart from the manual and automated deletion of unused images, the extension also supports performing these actions through the SSH scripts. You can use the following SSH commands to programmatically remove unused images in Magento 2:
- php bin/magento imageclean:product-unused-image:fetch – To fetch unused product images.
- php bin/magento imageclean:category-image:fetch – To fetch unused images of categories.
- php bin/magento imageclean:product-image:clean – To delete unused product images in Magento 2.
- php bin/magento imageclean:category-image:clean – To delete unused category images.
Conclusion
In Magento 2, the redundant images can add load to the server and ultimately affect the overall performance. Therefore, it is highly important to find and delete unused images in Magento 2 for efficient performance. Default Magento 2 does not provide any such functionality to clean the product residue images.
Magento 2 Image Clean extension by Meetanshi makes it easier for the store admins to find and delete unused images. The extension supports manual, scheduled, and individual deletion of unused images in Magento 2, and thus, is a life-saving solution for the stores having thousands of redundant images of deleted products.
Remove used as well as unused product and category images from media folder of your Magento 2 store.
Shivbhadrasinh Gohil
Shivbhadrasinh is the Co-founder & Chief Marketing Officer at Meetanshi. He leads the marketing team and is the person behind the marketing & branding success of the company. Being a seasoned digital marketer, he has been consulting online businesses for growth since 2010 and has helped 100+ clients with digital marketing success.
He loves sharing tips and insights about the latest digital marketing trends aimed at helping online business owners.
Prev
An Expert-approved List of Best Magento 2 SMS Notification Extensions
How to Dynamically Change Billing Address in Magento 2
Next