How To

Magento 2: How to Provide Access to your Custom Folder in the Media Gallery

Hello Magento Friends,

In the current Magento 2 tutorial, I will describe the steps to Provide Access to your Custom Folder in the Media Gallery for your Magento 2 store.

When it comes to managing media files in Magento 2, the default setup includes folders like ‘catalog,’ ‘product,’ and ‘category,’ which organize images and videos related to products and other store elements. However, there are times when you may need to create custom folders to organize media files for specific purposes, such as marketing campaigns, seasonal promotions, or user-generated content.

While creating custom folders is relatively straightforward, ensuring they are accessible through the Magento 2 admin panel’s media gallery interface requires a few additional steps. In this guide, we’ll walk you through the process of providing access to your custom folder in the media gallery, empowering you to streamline your media management workflow.

Steps to Provide Access to your Custom Folder in the Media Gallery for Magento 2:

Step 1: We need to create a “config.xml“ file inside our extension at the following path.

app\code\Vendor\Extension\etc\config.xml

Then add the code as follows

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
   <default>   
      <system>
         <media_storage_configuration>
            <allowed_resources>
               <media_gallery_image_folders>
                  <your_custom_folder_name>your_custom_folder_name</your_custom_folder_name>
               </media_gallery_image_folders>
            </allowed_resources>
         </media_storage_configuration>
        </system>
   </default>
</config>

NOTE: 

If you want to provide access to your old images in the media gallery, you need to enable the following admin configuration:

Stores > Configuration > Advanced > Media Gallery > Enable Old Media Gallery

Output:

Conclusion:

By following these steps, you can seamlessly integrate custom folders into Magento 2’s media gallery, providing a centralized location for managing your store’s media assets. Whether you’re organizing images for marketing campaigns, user-generated content, or any other purpose, this customization empowers you to maintain a tidy and efficient media management workflow within your Magento 2 store.

Hire Magento Developer to help you manage the media gallery of your Magento 2 store.

Happy Coding!

Click to rate this post!
[Total: 0 Average: 0]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate ?️ Certified Magento Developer?‍?. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.?

Recent Posts

How to Add Tooltip in Checkout Shipping Field in Magento 2?

Hello Magento Friends, In today’s blog, I will explain How to Add Tooltip in Checkout…

3 days ago

How to Integrate and Use MongoDB with Laravel?

MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…

4 days ago

NodeJS | Callback Function

In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…

5 days ago

How to Show SKU in Order Summary in Magento 2?

Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…

7 days ago

Best Colors to Use for CTA Buttons

The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…

1 week ago

Magento 2: How to Save Custom Field Value to quote_address for Multi-Shipping Orders

Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…

1 week ago