Bulk remove all product images from a Magento 2 shopMagento Delete all Product ImagesProduct images use default valueUpdating product images programmaticallyCan Default Magento Export Profile Export All Gallery Images?Use CDN url instead of image path with mysql bulk importProgramatically add images to product using skuProduct Catalog images cannot be indexedConfigurable product doesn't show simple product imagesExclude Swatch Image from Product Images when creating galleryGallery images returns 0 images for product page Magento 2How to remove hundreds seperator from all prices

What's the big deal about the Nazgûl losing their horses?

Is it possible that Curiosity measured its own methane or failed doing the spectrometry?

CPA filed late returns, stating I would get money; IRS says they were filed too late

How to take personal thing I lend to be used in the office without burning bridges?

Is it bad to suddenly introduce another element to your fantasy world a good ways into the story?

Before the 13th Amendment, could people sell themselves into slavery in the USA?

Why weren't Gemini capsules given names?

Question about targeting a Hexproof creature

How did Einstein know the speed of light was constant?

Convenience stores in India

PhD: When to quit and move on?

How to deal with a Murder Hobo Paladin?

Do I need to be legally qualified to install a Hive smart thermostat?

Did Snape really give Umbridge a fake Veritaserum potion that Harry later pretended to drink?

What do you call the angle of the direction of an airplane?

Taking advantage when the HR forgets to communicate the rules

What is the name of the technique when an element is repeated at different scales?

Recursive conversion from ExpandoObject to Dictionary<string, object>

Has there ever been a cold war other than between the U.S. and the U.S.S.R.?

What is exact meaning of “ich wäre gern”?

Is it possible to spoof an IP address to an exact number?

Explain how 'Sharing the burden' puzzle from Professor Layton and the Miracle Mask should be solved

Creating patterns

What is the addition in the re-released version of Avengers: Endgame?



Bulk remove all product images from a Magento 2 shop


Magento Delete all Product ImagesProduct images use default valueUpdating product images programmaticallyCan Default Magento Export Profile Export All Gallery Images?Use CDN url instead of image path with mysql bulk importProgramatically add images to product using skuProduct Catalog images cannot be indexedConfigurable product doesn't show simple product imagesExclude Swatch Image from Product Images when creating galleryGallery images returns 0 images for product page Magento 2How to remove hundreds seperator from all prices






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















We would like to remove all product images from the database and the file-system in Magento 2.2.8 shop.



There is a solution for Magento 1



Magento Delete all Product Images



Can this easily be adapted to Magento 2?



I am thinking about



  • rm -r pub/media/catalog/product/? pub/media/catalog/product/cache # keeping placeholder folder

  • And deleting from some tables in the database (which one) ?

  • Reindex

is this safe or are complications to expect?



We rather would not like to iterate over each product and save it, because of performance reasons.










share|improve this question




























    3















    We would like to remove all product images from the database and the file-system in Magento 2.2.8 shop.



    There is a solution for Magento 1



    Magento Delete all Product Images



    Can this easily be adapted to Magento 2?



    I am thinking about



    • rm -r pub/media/catalog/product/? pub/media/catalog/product/cache # keeping placeholder folder

    • And deleting from some tables in the database (which one) ?

    • Reindex

    is this safe or are complications to expect?



    We rather would not like to iterate over each product and save it, because of performance reasons.










    share|improve this question
























      3












      3








      3


      1






      We would like to remove all product images from the database and the file-system in Magento 2.2.8 shop.



      There is a solution for Magento 1



      Magento Delete all Product Images



      Can this easily be adapted to Magento 2?



      I am thinking about



      • rm -r pub/media/catalog/product/? pub/media/catalog/product/cache # keeping placeholder folder

      • And deleting from some tables in the database (which one) ?

      • Reindex

      is this safe or are complications to expect?



      We rather would not like to iterate over each product and save it, because of performance reasons.










      share|improve this question














      We would like to remove all product images from the database and the file-system in Magento 2.2.8 shop.



      There is a solution for Magento 1



      Magento Delete all Product Images



      Can this easily be adapted to Magento 2?



      I am thinking about



      • rm -r pub/media/catalog/product/? pub/media/catalog/product/cache # keeping placeholder folder

      • And deleting from some tables in the database (which one) ?

      • Reindex

      is this safe or are complications to expect?



      We rather would not like to iterate over each product and save it, because of performance reasons.







      gallery magento2.2.8






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 26 at 7:00









      AlexAlex

      9,48417 gold badges56 silver badges118 bronze badges




      9,48417 gold badges56 silver badges118 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          3














          Apart from:



          catalog_product_entity_media_gallery



          and



          catalog_product_entity_media_gallery_value



          tables, now Magento 2 has one more table



          catalog_product_entity_media_gallery_value_to_entity,



          which keeps track of removal of product in catalog_product_entity table, and relates this table to catalog_product_entity_media_gallery.



          You need to check this table also.



          One more table (catalog_product_entity_media_gallery_value_video) has been introduced in Magento 2, which keeps entries related to product videos.



          Please review this table if you have any videos for products.



          After the database operation, you can remove the image files from:




          • pub/media/catalog/product/ folder


          • pub/media/catalog/product/cache # keeping placeholder folder

          That's all.



          Note: Keep a backup of the database before doing any exercise on the database.






          share|improve this answer






























            0














            Based on mohit's answer:



            truncate catalog_product_entity_media_gallery_value;
            truncate catalog_product_entity_media_gallery_value_to_entity;
            delete from catalog_product_entity_media_gallery; # 9 sec
            delete from catalog_product_entity_varchar where attribute_id in ( select
            attribute_id from eav_attribute where attribute_code like "%image" and
            entity_type_id = 4 ); # 23 sec in our case (20000 Products)





            share|improve this answer

























              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%2f279633%2fbulk-remove-all-product-images-from-a-magento-2-shop%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              Apart from:



              catalog_product_entity_media_gallery



              and



              catalog_product_entity_media_gallery_value



              tables, now Magento 2 has one more table



              catalog_product_entity_media_gallery_value_to_entity,



              which keeps track of removal of product in catalog_product_entity table, and relates this table to catalog_product_entity_media_gallery.



              You need to check this table also.



              One more table (catalog_product_entity_media_gallery_value_video) has been introduced in Magento 2, which keeps entries related to product videos.



              Please review this table if you have any videos for products.



              After the database operation, you can remove the image files from:




              • pub/media/catalog/product/ folder


              • pub/media/catalog/product/cache # keeping placeholder folder

              That's all.



              Note: Keep a backup of the database before doing any exercise on the database.






              share|improve this answer



























                3














                Apart from:



                catalog_product_entity_media_gallery



                and



                catalog_product_entity_media_gallery_value



                tables, now Magento 2 has one more table



                catalog_product_entity_media_gallery_value_to_entity,



                which keeps track of removal of product in catalog_product_entity table, and relates this table to catalog_product_entity_media_gallery.



                You need to check this table also.



                One more table (catalog_product_entity_media_gallery_value_video) has been introduced in Magento 2, which keeps entries related to product videos.



                Please review this table if you have any videos for products.



                After the database operation, you can remove the image files from:




                • pub/media/catalog/product/ folder


                • pub/media/catalog/product/cache # keeping placeholder folder

                That's all.



                Note: Keep a backup of the database before doing any exercise on the database.






                share|improve this answer

























                  3












                  3








                  3







                  Apart from:



                  catalog_product_entity_media_gallery



                  and



                  catalog_product_entity_media_gallery_value



                  tables, now Magento 2 has one more table



                  catalog_product_entity_media_gallery_value_to_entity,



                  which keeps track of removal of product in catalog_product_entity table, and relates this table to catalog_product_entity_media_gallery.



                  You need to check this table also.



                  One more table (catalog_product_entity_media_gallery_value_video) has been introduced in Magento 2, which keeps entries related to product videos.



                  Please review this table if you have any videos for products.



                  After the database operation, you can remove the image files from:




                  • pub/media/catalog/product/ folder


                  • pub/media/catalog/product/cache # keeping placeholder folder

                  That's all.



                  Note: Keep a backup of the database before doing any exercise on the database.






                  share|improve this answer













                  Apart from:



                  catalog_product_entity_media_gallery



                  and



                  catalog_product_entity_media_gallery_value



                  tables, now Magento 2 has one more table



                  catalog_product_entity_media_gallery_value_to_entity,



                  which keeps track of removal of product in catalog_product_entity table, and relates this table to catalog_product_entity_media_gallery.



                  You need to check this table also.



                  One more table (catalog_product_entity_media_gallery_value_video) has been introduced in Magento 2, which keeps entries related to product videos.



                  Please review this table if you have any videos for products.



                  After the database operation, you can remove the image files from:




                  • pub/media/catalog/product/ folder


                  • pub/media/catalog/product/cache # keeping placeholder folder

                  That's all.



                  Note: Keep a backup of the database before doing any exercise on the database.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 26 at 7:14









                  Mohit Kumar AroraMohit Kumar Arora

                  7,3165 gold badges17 silver badges36 bronze badges




                  7,3165 gold badges17 silver badges36 bronze badges























                      0














                      Based on mohit's answer:



                      truncate catalog_product_entity_media_gallery_value;
                      truncate catalog_product_entity_media_gallery_value_to_entity;
                      delete from catalog_product_entity_media_gallery; # 9 sec
                      delete from catalog_product_entity_varchar where attribute_id in ( select
                      attribute_id from eav_attribute where attribute_code like "%image" and
                      entity_type_id = 4 ); # 23 sec in our case (20000 Products)





                      share|improve this answer



























                        0














                        Based on mohit's answer:



                        truncate catalog_product_entity_media_gallery_value;
                        truncate catalog_product_entity_media_gallery_value_to_entity;
                        delete from catalog_product_entity_media_gallery; # 9 sec
                        delete from catalog_product_entity_varchar where attribute_id in ( select
                        attribute_id from eav_attribute where attribute_code like "%image" and
                        entity_type_id = 4 ); # 23 sec in our case (20000 Products)





                        share|improve this answer

























                          0












                          0








                          0







                          Based on mohit's answer:



                          truncate catalog_product_entity_media_gallery_value;
                          truncate catalog_product_entity_media_gallery_value_to_entity;
                          delete from catalog_product_entity_media_gallery; # 9 sec
                          delete from catalog_product_entity_varchar where attribute_id in ( select
                          attribute_id from eav_attribute where attribute_code like "%image" and
                          entity_type_id = 4 ); # 23 sec in our case (20000 Products)





                          share|improve this answer













                          Based on mohit's answer:



                          truncate catalog_product_entity_media_gallery_value;
                          truncate catalog_product_entity_media_gallery_value_to_entity;
                          delete from catalog_product_entity_media_gallery; # 9 sec
                          delete from catalog_product_entity_varchar where attribute_id in ( select
                          attribute_id from eav_attribute where attribute_code like "%image" and
                          entity_type_id = 4 ); # 23 sec in our case (20000 Products)






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jun 28 at 7:58









                          AlexAlex

                          9,48417 gold badges56 silver badges118 bronze badges




                          9,48417 gold badges56 silver badges118 bronze badges



























                              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%2f279633%2fbulk-remove-all-product-images-from-a-magento-2-shop%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

                              Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Get RecordId in LWC From Community PageLWC Community recordId undefinedhow to get Personal Access Token from my integrated application LWC. I am using js onlylwc quick action from Opportunity page(aura:component) and not getting @api recordIdLWC Community recordId undefinedLWC - How to get label name of buttonsLWC: Add a region in custom community themeVisual force page redirection from lightning communityLWC NavigationMixin does not work in CommunityInvoking LWC component from a plain URL - Read URL Parameter inside LWCLWC download PDF fileLWC Get Pick-list Field Values