We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    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

    <?php
    MagentoFrameworkComponentComponentRegistrar::register(
        MagentoFrameworkComponentComponentRegistrar::MODULE,
        'Magemonkey_ImportFolder',
        __DIR__
    );

    Step 2 : Create file : app/code/Magemonkey/ImportFolder/etc/module.xml

    <?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

    <?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="MagentoCmsModelWysiwygImagesStorage">
    	    <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

    field_5bfb909c5ccae

      Get a Free Quote