Rating 5 stars - 1 votes

Batch remove Magento 2 images

In the process of performing Magento image upload, the pictures are placed to media/catalog/product in 2 subfolders that are created automatically on the basis of image names. At some point of time, these folders might become overburdened with images there are not still necessary.


Why May I Need To Batch Remove Magento 2 Images?

The reasons can be various: maybe some images were duplicated, or maybe after removing some products, their images were left at your FTP. Basically, those are unused images and they only occupy your server's disk space decreasing the site speed.


In case you are not familiar with coding and do not want to take risks modifying some important Magento files, you may consider using Store Manager for Magento tool. With this application you can massively remove images with no tech skills and in a reliable way.


As was mentioned above, you may need to remove images from some products or delete pictures that are not assigned to any goods and are stored at your server. Let's view each of them in more details.


How to Remove Magento 2 Images From Particular Products?

Instead of switching between products and deleting their images by hand, you can automate this process and batch clear Magento 2 Image Gallery with Store Manager. For that, do the following:

  1. Filter out the goods whose images you want to delete and launch Export Wizard.

  2. Launch Export Wizard in Store Manager
    Launch Export Wizard in Store Manager


  3. You need to export only 1 field - SKU.

  4. Select Fields for Export with Store Manager
    Select Fields for Export with Store Manager


    You might ask, "Why only one? And why is it SKU?". The thing is that Store Manager needs a product identifier to know which products have unused pictures. No additional data is required for such procedure. Such benefit will make the process super-fast.


  5. When you're done with the export, launch Import Wizard and use the exported file (with SKU field only) and make sure to check the 'Import Images' and 'Clear Gallery' boxes. You can tick the option allowing to remove images from FTP as well.

  6. Delete Images During Import Option
    Delete Images During Import Option


If the purpose of Magento 2 images import is only to update data (remove the images in our case), make sure to tick the 'Modify only' box at the last step of wizard.


Use Modify Only Option
Use Modify Only Option


Now when the image gallery of selected products is cleared, you can start adding new pictures.


Detect and Delete Unused Magento 2 Images from Your Server

Images not linked to any products are harder to detect, but sometimes removing them becomes a critical task, especially in case there is FTP quote. In this case, Store Diagnostics tool of Store Manager will help you out. Using it, you can make check-up and examine whether you have images that are not assigned to any of the items.

Select the checkbox that corresponds to selected type of diagnostics and run the process. Eventually, you will get the list of pictures that are not used for any products at your database and can remove them directly from this window.


Delete Magento Images with Store Diagnostics
Delete Magento Images with Store Diagnostics


If you have a lot of images to deal with, Store Manager for Magento is the best solution that doesn’t require many efforts.

Read more on Magento images upload here:

How to Import Magento 2 Images with Store Manager


Detect and delete Magento 2 images for free - Try for free



Related Articles:


add different images to different magento store views tutorial

How to Mass Exclude/ Unexclude Images from Gallery in Magento

Find out how to exclude particular images from Magetno gallery, so they will not be displayed on the product page. Read More...

import images with store manager for magento

Import Images With Store Manager for Magento

Full guidance on images import (local and remte images) and CSV import file sample. Read More...

import images from external urls to magento

Import Images from External URLs to Magento

Detailed guides on how to import images from URLs including the list of required CSV columns. Read More...

upload magento swatch images to configurable products

Upload Magento Swatch Images to Configurable Products

Get the full explanation of Magento swatch images and their purpuses and find out the ways to assign them to products via admin and Store Manager. Read More...


COMMENTS
Live Chat