Magento Delete all Product Images












8















I have a magento Installation which has had several image imports done by the client and its got wrong images in the wrong products, toasters with fridge freezers as the initial import had the wrong img names. After a further import via CSV it seems to have appended the images rather than change them.



I need to delete all product images on the site, then re-do the CORRECT import so all the images are correct.



Is there a quick way to delete all images then do a fresh import via Dataflow Profiles and re-map the correct fields?



Any help would be awesome!










share|improve this question





























    8















    I have a magento Installation which has had several image imports done by the client and its got wrong images in the wrong products, toasters with fridge freezers as the initial import had the wrong img names. After a further import via CSV it seems to have appended the images rather than change them.



    I need to delete all product images on the site, then re-do the CORRECT import so all the images are correct.



    Is there a quick way to delete all images then do a fresh import via Dataflow Profiles and re-map the correct fields?



    Any help would be awesome!










    share|improve this question



























      8












      8








      8


      5






      I have a magento Installation which has had several image imports done by the client and its got wrong images in the wrong products, toasters with fridge freezers as the initial import had the wrong img names. After a further import via CSV it seems to have appended the images rather than change them.



      I need to delete all product images on the site, then re-do the CORRECT import so all the images are correct.



      Is there a quick way to delete all images then do a fresh import via Dataflow Profiles and re-map the correct fields?



      Any help would be awesome!










      share|improve this question
















      I have a magento Installation which has had several image imports done by the client and its got wrong images in the wrong products, toasters with fridge freezers as the initial import had the wrong img names. After a further import via CSV it seems to have appended the images rather than change them.



      I need to delete all product images on the site, then re-do the CORRECT import so all the images are correct.



      Is there a quick way to delete all images then do a fresh import via Dataflow Profiles and re-map the correct fields?



      Any help would be awesome!







      magento-1.9 product-images






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 10 '16 at 2:30









      Amit Bera

      57.4k1474171




      57.4k1474171










      asked Jan 26 '15 at 12:33









      Andy SimpsonAndy Simpson

      77136




      77136






















          5 Answers
          5






          active

          oldest

          votes


















          16














          Fastest way to remove image,then follow below steps:
          delete all records from




          1. catalog_product_entity_media_gallery

          2. catalog_product_entity_media_gallery_value'


          table because magento is save all product image data at those table.



          Then index from Index management from admin for set image black.



          Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.



          Another Process:



          Andy Simpson,you need a script which is delete all product from your system which will delete from DB and file system.



          Step1: Create a php at root direct of magento system which include Mage.php at first code.



          require_once "YOURMAGENTODIR/app/Mage.php";
          umask(0);


          Step2: set current store is admin and set Developer mode



          Mage::app('admin');
          Mage::setIsDeveloperMode(true);


          Step3: Get Product Collection and create a loop for get one product by one by one



          $productCollection=Mage::getResourceModel('catalog/product_collection');


          Step4: fetch product image by one and remove image one using below code:



          $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);




          FULL CODE:



          <?php
          require_once "YOURMAGENTODIR/app/Mage.php";
          umask(0);
          Mage::app('admin');
          Mage::setIsDeveloperMode(true);

          $productCollection=Mage::getResourceModel('catalog/product_collection');
          foreach($productCollection as $product){
          echo $product->getId();
          echo "<br/>";
          $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
          echo $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
          echo "<br/>";

          $MediaGallery=Mage::getModel('catalog/product_attribute_media_api')->items($product->getId());
          echo "<pre>";
          print_r($MediaGallery);
          echo "</pre>";

          foreach($MediaGallery as $eachImge){
          $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
          $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
          $DirImagePath=str_replace("/",DS,$eachImge['file']);
          $DirImagePath=$DirImagePath;
          // remove file from Dir

          $io = new Varien_Io_File();
          $io->rm($MediaCatalogDir.$DirImagePath);

          $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);
          }


          }





          share|improve this answer


























          • Hi, thanks for your reply, I have created the php file and called it delete-image.php, how do I execute the script, do I need to visit the page via browser? I have also changed catalog/product_collection to catalog/product as this is where the images are, is that correct? thanks for your help.

            – Andy Simpson
            Jan 26 '15 at 15:00








          • 1





            use php shell execution,it is better process.... else hit your file from page via browser

            – Amit Bera
            Jan 26 '15 at 19:14











          • for me... it is deleting the first product's images only

            – Alam Zaib
            Oct 28 '18 at 7:16



















          2














          The full mysql statement for Amit's answer is



          SET FOREIGN_KEY_CHECKS = 0;
          TRUNCATE TABLE catalog_product_entity_media_gallery;
          TRUNCATE TABLE catalog_product_entity_media_gallery_value;
          SET FOREIGN_KEY_CHECKS = 1;





          share|improve this answer































            0














            I don't think there is a quick fix to this unless you can reimport all your products from a backup export with the correct image data.



            You could use a PHP script to loop through all your products and remove the media. Have a look at https://stackoverflow.com/questions/5709496/magento-programmatically-remove-product-images for more info.



            You can safely delete /media/catalog/product/ and restore if you have a working backup with the correct image files.






            share|improve this answer

































              0














              I used to Kevando on magento 2.2.7 but when import images again will not exactly. So this is my answers it's be tested.



              SET FOREIGN_KEY_CHECKS = 0;
              TRUNCATE TABLE catalog_product_entity_media_gallery;
              TRUNCATE TABLE catalog_product_entity_media_gallery_value;
              TRUNCATE TABLE catalog_product_entity_media_gallery_value_to_entity;
              SET FOREIGN_KEY_CHECKS = 1;





              share|improve this answer































                -2














                Thanks "Amit Bera", It's saved my day and working fine



                Just I followed the below procedure to delete all product images.



                Fastest way to remove image,then follow below steps: delete all records from



                catalog_product_entity_media_gallery
                catalog_product_entity_media_gallery_value'
                table because magento is save all product image data at those table.



                Then index from Index management from admin for set image black.



                Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.






                share|improve this answer
























                • Can you please explain why -1 for this.

                  – Rajesh Jai
                  Sep 21 '17 at 10:19











                • It's not an answer

                  – seanbreeden
                  Mar 26 '18 at 14:35











                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "479"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f53356%2fmagento-delete-all-product-images%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                16














                Fastest way to remove image,then follow below steps:
                delete all records from




                1. catalog_product_entity_media_gallery

                2. catalog_product_entity_media_gallery_value'


                table because magento is save all product image data at those table.



                Then index from Index management from admin for set image black.



                Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.



                Another Process:



                Andy Simpson,you need a script which is delete all product from your system which will delete from DB and file system.



                Step1: Create a php at root direct of magento system which include Mage.php at first code.



                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);


                Step2: set current store is admin and set Developer mode



                Mage::app('admin');
                Mage::setIsDeveloperMode(true);


                Step3: Get Product Collection and create a loop for get one product by one by one



                $productCollection=Mage::getResourceModel('catalog/product_collection');


                Step4: fetch product image by one and remove image one using below code:



                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);




                FULL CODE:



                <?php
                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);
                Mage::app('admin');
                Mage::setIsDeveloperMode(true);

                $productCollection=Mage::getResourceModel('catalog/product_collection');
                foreach($productCollection as $product){
                echo $product->getId();
                echo "<br/>";
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                echo $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                echo "<br/>";

                $MediaGallery=Mage::getModel('catalog/product_attribute_media_api')->items($product->getId());
                echo "<pre>";
                print_r($MediaGallery);
                echo "</pre>";

                foreach($MediaGallery as $eachImge){
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                $DirImagePath=str_replace("/",DS,$eachImge['file']);
                $DirImagePath=$DirImagePath;
                // remove file from Dir

                $io = new Varien_Io_File();
                $io->rm($MediaCatalogDir.$DirImagePath);

                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);
                }


                }





                share|improve this answer


























                • Hi, thanks for your reply, I have created the php file and called it delete-image.php, how do I execute the script, do I need to visit the page via browser? I have also changed catalog/product_collection to catalog/product as this is where the images are, is that correct? thanks for your help.

                  – Andy Simpson
                  Jan 26 '15 at 15:00








                • 1





                  use php shell execution,it is better process.... else hit your file from page via browser

                  – Amit Bera
                  Jan 26 '15 at 19:14











                • for me... it is deleting the first product's images only

                  – Alam Zaib
                  Oct 28 '18 at 7:16
















                16














                Fastest way to remove image,then follow below steps:
                delete all records from




                1. catalog_product_entity_media_gallery

                2. catalog_product_entity_media_gallery_value'


                table because magento is save all product image data at those table.



                Then index from Index management from admin for set image black.



                Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.



                Another Process:



                Andy Simpson,you need a script which is delete all product from your system which will delete from DB and file system.



                Step1: Create a php at root direct of magento system which include Mage.php at first code.



                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);


                Step2: set current store is admin and set Developer mode



                Mage::app('admin');
                Mage::setIsDeveloperMode(true);


                Step3: Get Product Collection and create a loop for get one product by one by one



                $productCollection=Mage::getResourceModel('catalog/product_collection');


                Step4: fetch product image by one and remove image one using below code:



                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);




                FULL CODE:



                <?php
                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);
                Mage::app('admin');
                Mage::setIsDeveloperMode(true);

                $productCollection=Mage::getResourceModel('catalog/product_collection');
                foreach($productCollection as $product){
                echo $product->getId();
                echo "<br/>";
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                echo $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                echo "<br/>";

                $MediaGallery=Mage::getModel('catalog/product_attribute_media_api')->items($product->getId());
                echo "<pre>";
                print_r($MediaGallery);
                echo "</pre>";

                foreach($MediaGallery as $eachImge){
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                $DirImagePath=str_replace("/",DS,$eachImge['file']);
                $DirImagePath=$DirImagePath;
                // remove file from Dir

                $io = new Varien_Io_File();
                $io->rm($MediaCatalogDir.$DirImagePath);

                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);
                }


                }





                share|improve this answer


























                • Hi, thanks for your reply, I have created the php file and called it delete-image.php, how do I execute the script, do I need to visit the page via browser? I have also changed catalog/product_collection to catalog/product as this is where the images are, is that correct? thanks for your help.

                  – Andy Simpson
                  Jan 26 '15 at 15:00








                • 1





                  use php shell execution,it is better process.... else hit your file from page via browser

                  – Amit Bera
                  Jan 26 '15 at 19:14











                • for me... it is deleting the first product's images only

                  – Alam Zaib
                  Oct 28 '18 at 7:16














                16












                16








                16







                Fastest way to remove image,then follow below steps:
                delete all records from




                1. catalog_product_entity_media_gallery

                2. catalog_product_entity_media_gallery_value'


                table because magento is save all product image data at those table.



                Then index from Index management from admin for set image black.



                Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.



                Another Process:



                Andy Simpson,you need a script which is delete all product from your system which will delete from DB and file system.



                Step1: Create a php at root direct of magento system which include Mage.php at first code.



                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);


                Step2: set current store is admin and set Developer mode



                Mage::app('admin');
                Mage::setIsDeveloperMode(true);


                Step3: Get Product Collection and create a loop for get one product by one by one



                $productCollection=Mage::getResourceModel('catalog/product_collection');


                Step4: fetch product image by one and remove image one using below code:



                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);




                FULL CODE:



                <?php
                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);
                Mage::app('admin');
                Mage::setIsDeveloperMode(true);

                $productCollection=Mage::getResourceModel('catalog/product_collection');
                foreach($productCollection as $product){
                echo $product->getId();
                echo "<br/>";
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                echo $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                echo "<br/>";

                $MediaGallery=Mage::getModel('catalog/product_attribute_media_api')->items($product->getId());
                echo "<pre>";
                print_r($MediaGallery);
                echo "</pre>";

                foreach($MediaGallery as $eachImge){
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                $DirImagePath=str_replace("/",DS,$eachImge['file']);
                $DirImagePath=$DirImagePath;
                // remove file from Dir

                $io = new Varien_Io_File();
                $io->rm($MediaCatalogDir.$DirImagePath);

                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);
                }


                }





                share|improve this answer















                Fastest way to remove image,then follow below steps:
                delete all records from




                1. catalog_product_entity_media_gallery

                2. catalog_product_entity_media_gallery_value'


                table because magento is save all product image data at those table.



                Then index from Index management from admin for set image black.



                Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.



                Another Process:



                Andy Simpson,you need a script which is delete all product from your system which will delete from DB and file system.



                Step1: Create a php at root direct of magento system which include Mage.php at first code.



                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);


                Step2: set current store is admin and set Developer mode



                Mage::app('admin');
                Mage::setIsDeveloperMode(true);


                Step3: Get Product Collection and create a loop for get one product by one by one



                $productCollection=Mage::getResourceModel('catalog/product_collection');


                Step4: fetch product image by one and remove image one using below code:



                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);




                FULL CODE:



                <?php
                require_once "YOURMAGENTODIR/app/Mage.php";
                umask(0);
                Mage::app('admin');
                Mage::setIsDeveloperMode(true);

                $productCollection=Mage::getResourceModel('catalog/product_collection');
                foreach($productCollection as $product){
                echo $product->getId();
                echo "<br/>";
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                echo $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                echo "<br/>";

                $MediaGallery=Mage::getModel('catalog/product_attribute_media_api')->items($product->getId());
                echo "<pre>";
                print_r($MediaGallery);
                echo "</pre>";

                foreach($MediaGallery as $eachImge){
                $MediaDir=Mage::getConfig()->getOptions()->getMediaDir();
                $MediaCatalogDir=$MediaDir .DS . 'catalog' . DS . 'product';
                $DirImagePath=str_replace("/",DS,$eachImge['file']);
                $DirImagePath=$DirImagePath;
                // remove file from Dir

                $io = new Varien_Io_File();
                $io->rm($MediaCatalogDir.$DirImagePath);

                $remove=Mage::getModel('catalog/product_attribute_media_api')->remove($product->getId(),$eachImge['file']);
                }


                }






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 7 '15 at 18:37

























                answered Jan 26 '15 at 14:08









                Amit BeraAmit Bera

                57.4k1474171




                57.4k1474171













                • Hi, thanks for your reply, I have created the php file and called it delete-image.php, how do I execute the script, do I need to visit the page via browser? I have also changed catalog/product_collection to catalog/product as this is where the images are, is that correct? thanks for your help.

                  – Andy Simpson
                  Jan 26 '15 at 15:00








                • 1





                  use php shell execution,it is better process.... else hit your file from page via browser

                  – Amit Bera
                  Jan 26 '15 at 19:14











                • for me... it is deleting the first product's images only

                  – Alam Zaib
                  Oct 28 '18 at 7:16



















                • Hi, thanks for your reply, I have created the php file and called it delete-image.php, how do I execute the script, do I need to visit the page via browser? I have also changed catalog/product_collection to catalog/product as this is where the images are, is that correct? thanks for your help.

                  – Andy Simpson
                  Jan 26 '15 at 15:00








                • 1





                  use php shell execution,it is better process.... else hit your file from page via browser

                  – Amit Bera
                  Jan 26 '15 at 19:14











                • for me... it is deleting the first product's images only

                  – Alam Zaib
                  Oct 28 '18 at 7:16

















                Hi, thanks for your reply, I have created the php file and called it delete-image.php, how do I execute the script, do I need to visit the page via browser? I have also changed catalog/product_collection to catalog/product as this is where the images are, is that correct? thanks for your help.

                – Andy Simpson
                Jan 26 '15 at 15:00







                Hi, thanks for your reply, I have created the php file and called it delete-image.php, how do I execute the script, do I need to visit the page via browser? I have also changed catalog/product_collection to catalog/product as this is where the images are, is that correct? thanks for your help.

                – Andy Simpson
                Jan 26 '15 at 15:00






                1




                1





                use php shell execution,it is better process.... else hit your file from page via browser

                – Amit Bera
                Jan 26 '15 at 19:14





                use php shell execution,it is better process.... else hit your file from page via browser

                – Amit Bera
                Jan 26 '15 at 19:14













                for me... it is deleting the first product's images only

                – Alam Zaib
                Oct 28 '18 at 7:16





                for me... it is deleting the first product's images only

                – Alam Zaib
                Oct 28 '18 at 7:16













                2














                The full mysql statement for Amit's answer is



                SET FOREIGN_KEY_CHECKS = 0;
                TRUNCATE TABLE catalog_product_entity_media_gallery;
                TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                SET FOREIGN_KEY_CHECKS = 1;





                share|improve this answer




























                  2














                  The full mysql statement for Amit's answer is



                  SET FOREIGN_KEY_CHECKS = 0;
                  TRUNCATE TABLE catalog_product_entity_media_gallery;
                  TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                  SET FOREIGN_KEY_CHECKS = 1;





                  share|improve this answer


























                    2












                    2








                    2







                    The full mysql statement for Amit's answer is



                    SET FOREIGN_KEY_CHECKS = 0;
                    TRUNCATE TABLE catalog_product_entity_media_gallery;
                    TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                    SET FOREIGN_KEY_CHECKS = 1;





                    share|improve this answer













                    The full mysql statement for Amit's answer is



                    SET FOREIGN_KEY_CHECKS = 0;
                    TRUNCATE TABLE catalog_product_entity_media_gallery;
                    TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                    SET FOREIGN_KEY_CHECKS = 1;






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 30 '16 at 19:01









                    kevandokevando

                    4241822




                    4241822























                        0














                        I don't think there is a quick fix to this unless you can reimport all your products from a backup export with the correct image data.



                        You could use a PHP script to loop through all your products and remove the media. Have a look at https://stackoverflow.com/questions/5709496/magento-programmatically-remove-product-images for more info.



                        You can safely delete /media/catalog/product/ and restore if you have a working backup with the correct image files.






                        share|improve this answer






























                          0














                          I don't think there is a quick fix to this unless you can reimport all your products from a backup export with the correct image data.



                          You could use a PHP script to loop through all your products and remove the media. Have a look at https://stackoverflow.com/questions/5709496/magento-programmatically-remove-product-images for more info.



                          You can safely delete /media/catalog/product/ and restore if you have a working backup with the correct image files.






                          share|improve this answer




























                            0












                            0








                            0







                            I don't think there is a quick fix to this unless you can reimport all your products from a backup export with the correct image data.



                            You could use a PHP script to loop through all your products and remove the media. Have a look at https://stackoverflow.com/questions/5709496/magento-programmatically-remove-product-images for more info.



                            You can safely delete /media/catalog/product/ and restore if you have a working backup with the correct image files.






                            share|improve this answer















                            I don't think there is a quick fix to this unless you can reimport all your products from a backup export with the correct image data.



                            You could use a PHP script to loop through all your products and remove the media. Have a look at https://stackoverflow.com/questions/5709496/magento-programmatically-remove-product-images for more info.



                            You can safely delete /media/catalog/product/ and restore if you have a working backup with the correct image files.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited May 23 '17 at 12:37









                            Community

                            1




                            1










                            answered Jan 26 '15 at 13:18









                            pajpaj

                            2,60521026




                            2,60521026























                                0














                                I used to Kevando on magento 2.2.7 but when import images again will not exactly. So this is my answers it's be tested.



                                SET FOREIGN_KEY_CHECKS = 0;
                                TRUNCATE TABLE catalog_product_entity_media_gallery;
                                TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                                TRUNCATE TABLE catalog_product_entity_media_gallery_value_to_entity;
                                SET FOREIGN_KEY_CHECKS = 1;





                                share|improve this answer




























                                  0














                                  I used to Kevando on magento 2.2.7 but when import images again will not exactly. So this is my answers it's be tested.



                                  SET FOREIGN_KEY_CHECKS = 0;
                                  TRUNCATE TABLE catalog_product_entity_media_gallery;
                                  TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                                  TRUNCATE TABLE catalog_product_entity_media_gallery_value_to_entity;
                                  SET FOREIGN_KEY_CHECKS = 1;





                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    I used to Kevando on magento 2.2.7 but when import images again will not exactly. So this is my answers it's be tested.



                                    SET FOREIGN_KEY_CHECKS = 0;
                                    TRUNCATE TABLE catalog_product_entity_media_gallery;
                                    TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                                    TRUNCATE TABLE catalog_product_entity_media_gallery_value_to_entity;
                                    SET FOREIGN_KEY_CHECKS = 1;





                                    share|improve this answer













                                    I used to Kevando on magento 2.2.7 but when import images again will not exactly. So this is my answers it's be tested.



                                    SET FOREIGN_KEY_CHECKS = 0;
                                    TRUNCATE TABLE catalog_product_entity_media_gallery;
                                    TRUNCATE TABLE catalog_product_entity_media_gallery_value;
                                    TRUNCATE TABLE catalog_product_entity_media_gallery_value_to_entity;
                                    SET FOREIGN_KEY_CHECKS = 1;






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 12 mins ago









                                    xankaxanka

                                    98331849




                                    98331849























                                        -2














                                        Thanks "Amit Bera", It's saved my day and working fine



                                        Just I followed the below procedure to delete all product images.



                                        Fastest way to remove image,then follow below steps: delete all records from



                                        catalog_product_entity_media_gallery
                                        catalog_product_entity_media_gallery_value'
                                        table because magento is save all product image data at those table.



                                        Then index from Index management from admin for set image black.



                                        Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.






                                        share|improve this answer
























                                        • Can you please explain why -1 for this.

                                          – Rajesh Jai
                                          Sep 21 '17 at 10:19











                                        • It's not an answer

                                          – seanbreeden
                                          Mar 26 '18 at 14:35
















                                        -2














                                        Thanks "Amit Bera", It's saved my day and working fine



                                        Just I followed the below procedure to delete all product images.



                                        Fastest way to remove image,then follow below steps: delete all records from



                                        catalog_product_entity_media_gallery
                                        catalog_product_entity_media_gallery_value'
                                        table because magento is save all product image data at those table.



                                        Then index from Index management from admin for set image black.



                                        Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.






                                        share|improve this answer
























                                        • Can you please explain why -1 for this.

                                          – Rajesh Jai
                                          Sep 21 '17 at 10:19











                                        • It's not an answer

                                          – seanbreeden
                                          Mar 26 '18 at 14:35














                                        -2












                                        -2








                                        -2







                                        Thanks "Amit Bera", It's saved my day and working fine



                                        Just I followed the below procedure to delete all product images.



                                        Fastest way to remove image,then follow below steps: delete all records from



                                        catalog_product_entity_media_gallery
                                        catalog_product_entity_media_gallery_value'
                                        table because magento is save all product image data at those table.



                                        Then index from Index management from admin for set image black.



                                        Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.






                                        share|improve this answer













                                        Thanks "Amit Bera", It's saved my day and working fine



                                        Just I followed the below procedure to delete all product images.



                                        Fastest way to remove image,then follow below steps: delete all records from



                                        catalog_product_entity_media_gallery
                                        catalog_product_entity_media_gallery_value'
                                        table because magento is save all product image data at those table.



                                        Then index from Index management from admin for set image black.



                                        Then remove image from dir then goto Your magento dir at media/catalog/product and from this folder delete all file.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Jun 24 '16 at 11:11









                                        Rajesh JaiRajesh Jai

                                        172




                                        172













                                        • Can you please explain why -1 for this.

                                          – Rajesh Jai
                                          Sep 21 '17 at 10:19











                                        • It's not an answer

                                          – seanbreeden
                                          Mar 26 '18 at 14:35



















                                        • Can you please explain why -1 for this.

                                          – Rajesh Jai
                                          Sep 21 '17 at 10:19











                                        • It's not an answer

                                          – seanbreeden
                                          Mar 26 '18 at 14:35

















                                        Can you please explain why -1 for this.

                                        – Rajesh Jai
                                        Sep 21 '17 at 10:19





                                        Can you please explain why -1 for this.

                                        – Rajesh Jai
                                        Sep 21 '17 at 10:19













                                        It's not an answer

                                        – seanbreeden
                                        Mar 26 '18 at 14:35





                                        It's not an answer

                                        – seanbreeden
                                        Mar 26 '18 at 14:35


















                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Magento Stack Exchange!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f53356%2fmagento-delete-all-product-images%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Magento 2 controller redirect on button click in phtml file

                                        Polycentropodidae