10

I have more than 50,000 images in pub/media of products.

But there are so many unused images so I want to remove all images which are not associated with any product.

For magento 1.9.x this can be a Reference link but i want the same php script for magento 2.1.

12

You can use the Hackathon EAV cleaner module for this. After installation you can use the command eav:media:remove-unused

You can find it on Github: https://github.com/magento-hackathon/EAVCleaner/tree/magento2

| improve this answer | |
  • let me try it, will let you know. – Ronak Chauhan Dec 19 '16 at 11:53
  • It's working for me, Thank you so much :) – Ronak Chauhan Dec 19 '16 at 12:05
  • By the way, i've forked the repo so it is now possible to use composer installation: github.com/Vendic/EAVCleaner. The old repo seems to be inactive. – Tjitse Mar 1 '19 at 12:06
  • I've tried to install this. Composer doesn't find it and copying it directly doesn't work for me. Can you point me to or provide some simple instructions please? – PedroKTFC May 29 '19 at 21:59
  • Try composer require hackathon/magento2-eavcleaner – Tjitse May 30 '19 at 7:53
0

After installing the EAC cleaner module, I ran the /opt/cpanel/ea-php72/root/usr/bin/php bin/magento eav:media:remove-unused and got the error message below. Any suggestions?

There are no commands defined in the "eav:media" namespace.

Thank you!

| improve this answer | |
  • check if php is installed or not using 'php -v' command, if installed then use command 'php bin/magento eav:media:remove-unused' command to remove images – Ronak Chauhan Dec 11 '19 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.