MagestyApps / module-web-images

Magento 2 module for uploading images in optimised formats (SVG, WebP, etc.)
https://www.magestyapps.com
93 stars 16 forks source link

Doesn't work on Magento Ver.-2.3.2 #1

Closed a-fellerer closed 3 years ago

a-fellerer commented 3 years ago

I'm trying to upload a simple svg file in magento media manager in a static block, but it doesn't work after installing your extension.

File is: https://www.stainer-sunwood.com/wp-content/uploads/2021/04/Showroom-Beratung.svg

Please check your documentation! In the manual installation section you are speaking of "AdvancedBreadcrumbs".

After Composer Installation there are no files in app/code/

umar1904 commented 3 years ago

I'm trying to upload a simple svg file in magento media manager in a static block, but it doesn't work after installing your extension.

File is: https://www.stainer-sunwood.com/wp-content/uploads/2021/04/Showroom-Beratung.svg

Please check your documentation! In the manual installation section you are speaking of "AdvancedBreadcrumbs".

After Composer Installation there are no files in app/code/

  1. After composer install, the files will appear under vendor/magestyapps/.. not in app/code/..
  2. Yes, the readme file must have been a copy/paste from an other module, it should read WebImages, - and that is if you're installing the module manually under app/code/...
  3. Finally for the actual fix on this issue; the di.xml file needs to be fixed for it to all work again. This is how it can be done, - the string type value needs to be image/svg+xml:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2021 MagestyApps. All rights reserved.
 * See LICENSE.txt for license details.
 */
 -->
<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="extensions" xsi:type="array">
                <item name="allowed" xsi:type="array">
                    <item name="svg" xsi:type="string">image/svg+xml</item>
                </item>
                <item name="image_allowed" xsi:type="array">
                    <item name="svg" xsi:type="string">image/svg+xml</item>
                </item>
            </argument>
        </arguments>
    </type>
    <virtualType name="Magento\Catalog\CategoryImageUpload" type="Magento\Catalog\Model\ImageUploader">
        <arguments>
            <argument name="allowedExtensions" xsi:type="array">
                <item name="svg" xsi:type="string">image/svg+xml</item>
            </argument>
            <argument name="allowedMimeTypes" xsi:type="array">
                <item name="svg" xsi:type="string">image/svg+xml</item>
            </argument>
        </arguments>
    </virtualType>

    <type name="Magento\MediaStorage\Model\File\Validator\NotProtectedExtension">
        <plugin name="allow-svg" type="MagestyApps\WebImages\Plugin\File\Validator\NotProtectedExtensionPlugin" />
    </type>
    <type name="Magento\Cms\Model\Wysiwyg\Images\Storage">
        <plugin name="allow-svg" type="MagestyApps\WebImages\Plugin\Wysiwyg\Images\StoragePlugin" />
    </type>
    <type name="Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Thumbnail">
        <plugin name="allow-svg" type="MagestyApps\WebImages\Plugin\Controller\Adminhtml\Wysiwyg\Images\ThumbnailPlugin" />
    </type>
    <type name="Magento\Cms\Controller\Adminhtml\Wysiwyg\Directive">
        <plugin name="allow-svg" type="MagestyApps\WebImages\Plugin\Controller\Adminhtml\Wysiwyg\DirectivePlugin" />
    </type>

    <type name="Magento\Theme\Model\Design\Backend\Logo">
        <plugin name="allow-svg" type="MagestyApps\WebImages\Plugin\Design\Backend\ImagePlugin" />
    </type>
    <type name="Magento\Theme\Model\Design\Backend\Favicon">
        <plugin name="allow-svg" type="MagestyApps\WebImages\Plugin\Design\Backend\ImagePlugin" />
    </type>
    <type name="Magento\Theme\Model\Design\Backend\Image">
        <plugin name="allow-svg" type="MagestyApps\WebImages\Plugin\Design\Backend\ImagePlugin" />
    </type>
</config>
a-fellerer commented 3 years ago

Works now!

umar1904 commented 3 years ago

@Chatcloud , @MagestyApps

Works now!

here is the pull request for the fix ready for composer thanks! https://github.com/MagestyApps/module-web-images/pull/2

paulfanjysk commented 3 years ago

seems not work with 2.4, with above fix on di.xml image image

umar1904 commented 3 years ago

seems not work with 2.4, with above fix on di.xml image image

Seems like it starts to work again every time you flush caches, var/generation & view_preprocessed are cleared etc.. hmmm odd, that's with or without the changes i made on 2.4.2. Either way its still solved even without the pull request.

Thanks.

MagestyApps commented 3 years ago

The issue have been fixed in version 1.0.2. Please, try upgrading the extension version. And please let us know if you're still facing the issue after the upgrade.