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

Magento 2: Add Quantity Increment and Decrement on Category Page

Hello Magento Friends, In this blog, we will discuss about adding quantity increment and decrement…

2 days ago

How to Integrate ChatGPT with Laravel Application?

In this guide, we'll explore how to integrate ChatGPT, an AI-powered chatbot, with a Laravel…

5 days ago

What are Net Sales? How to Calculate Your Net Sales?

In the world of business, understanding financial metrics is crucial for making informed decisions and…

7 days ago

Magento 2 Extensions Digest April 2024 (New Release & Updates)

Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…

7 days ago

The ABCs of Geofencing: Definition, Features and Uses

In this era, businesses are always on the lookout for ways to engage with their…

1 week ago

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

1 week ago