Let’s initiate a discussion!!
Magento 2 is not having this by default setting to see import folder of pub/media in ‘Insert Images’ section under CMS Page or Blocks.
If you want to show import folder in CMS Page or Blocks then follow below steps.
Step 1 : Create file : app/code/Magemonkey/ImportFolder/registration.php
1 2 3 4 5 6 |
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Magemonkey_ImportFolder', __DIR__ ); |
Step 2 : Create file : app/code/Magemonkey/ImportFolder/etc/module.xml
1 2 3 4 5 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magemonkey_ImportFolder" setup_version="1.0.0"> </module> </config> |
Step 3 : Create file : app/code/Magemonkey/ImportFolder/etc/di.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Cms\Model\Wysiwyg\Images\Storage"> <arguments> <argument name="dirs" xsi:type="array"> <item name="include" xsi:type="array"> <item name="import" xsi:type="array"> <item name="regexp" xsi:type="boolean">true</item> <item name="name" xsi:type="string">pub[/\\]+media[/\\]+import[/\\]*$</item> </item> </item> </argument> </arguments> </type> </config> |
Step 4 : Remove or comment .htaccess file under import folder
After that run below commands
– php bin/magento setup:upgrade
– php bin/magento setup:static-content:deploy
– php bin/magento cache:clean
Thats it.
Now clean cache and check in admin side under CMS Page or Blocks ‘Insert Images’ section. Import folder should be visible there.
You can also use this folder image in CMS Page or Blocks
[crayon-64216ebbaf72c642654103/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.