Hello Magento Friends,

Today I will explain How to Allow Custom Image Type When Uploading Image from Page Builder in Magento 2.

The page builder in Magento 2 is a drag-and-drop tool for creating content. With Page Builder, you can work with various content types to build a page. One such content type in Magento 2 Page Builder is images. Apart from page builder, you can add image to product programmatically in Magento 2. Check out the article for Magento 2 add image to product programmatically.

One can add a custom image uploader in Magento 2 page builder. Whenever there is a need to add custom image in Magento 2, you need to add custom image uploader. For example, if you want to add WebP images in Magento 2, you can allow custom option image for Magento 2. By using Magento 2 WebP Image Converter automatically converts your images to WebP format.

Let’s get started with the Steps to Allow Custom Image Type When Uploading Image from Page Builder in Magento 2.

Steps to Allow Custom Image Type When Uploading Image from Page Builder in Magento 2:

Step 1: Move to the below file path

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

And code as follows

Step 2: Now move to the below file path

app\code\Vendor\Extension\Controller\Adminhtml\ContentType\Image\Upload.php

Add the below-mentioned code

Step 3: Now move to the following file path

app\code\Vendor\Extension\view\base\requirejs-config.js

Then add the code as below

Step 4: Then navigate to the below file path

app\code\Vendor\Extension\view\base\web\js\form\element\file-uploader.js

Add code as follows

Step 5: After that run the below commands

Conclusion:

This way you can easily allow custom image type when uploading image from page builder in Magento 2. If you have any doubt about executing the above steps, feel free to ask me through the comment part. Share the tutorial with your friends and stay in touch with us.

Happy Coding!

Click to rate this post!
[Total: 7 Average: 3.3]