magestyapps / module-web-images Goto Github PK
View Code? Open in Web Editor NEWMagento 2 module for uploading images in optimised formats (SVG, WebP, etc.)
Home Page: https://www.magestyapps.com
Magento 2 module for uploading images in optimised formats (SVG, WebP, etc.)
Home Page: https://www.magestyapps.com
Modules has mixin for UI component Magento_Ui/js/form/element/image-uploader
. This mixin always extends allowedExtensions property with strings svg
and webp
.
Originally in Magento when allowedExtensions has boolean value false
then file with any extension can be uploaded.
Property allowedExtenmsion has value false svg webp
after running the mixin mentioned above. And almost any image file except svg and webp not possible to upload.
I offer next modification:
--- /tmp/fz3temp-2/image-uploader-mixin.js
+++ /tmp/fz3temp-2/image-uploader-mixin.js (Unsaved)
@@ -11,8 +11,10 @@
initialize: function () {
this._super();
- this.allowedExtensions += ' svg';
- this.allowedExtensions += ' webp';
+ if (typeof this.allowedExtensions === 'string') {
+ this.allowedExtensions += ' svg';
+ this.allowedExtensions += ' webp';
+ }
}
});
};
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/
I already had a folder with a lot of .svg's in it, and the following commands did not pull them in to the media gallery, like they did for the default file types:
bin/magento media-content:sync
bin/magento media-gallery:sync
I was able to fix this by adding the following to the di.xml in MagestyApps/WebImages/etc/di.xml
<type name="Magento\MediaGallerySynchronization\Model\FetchMediaStorageFileBatches">
<arguments>
<argument name="fileExtensions" xsi:type="array">
<item name="svg" xsi:type="string">svg</item>
<item name="webp" xsi:type="string">webp</item>
</argument>
</arguments>
</type>
Magento 2.4.1
I am getting the following error
Compilation was started.
Area configuration aggregation... 5/9 [===============>------------] 55% 1 min 406.0 MiB
In ClassReader.php line 45:
Impossible to process constructor argument Parameter #14 [ Magento\Catalog\Model\Config\CatalogMediaConfig or NULL $catalogMediaConfig = NULL ] of MagestyApps\WebImages\App\MediaRewrite class
In ClassReader.php line 34:
Class Magento\Catalog\Model\Config\CatalogMediaConfig does not exist
can you guys help
I run following code for import product with image.
$product = $objectManager->get('Magento\Catalog\Model\Product')->load(4);
$importDir = '/var/www/magento/pub/media/import;
//$url = $importDir . $product->getImage();
$product->addImageToMediaGallery("$importDir/zion-t-zzz-un.webp", array('image', 'small_image', 'thumbnail'), false, false);
$product->save();
I got the following error.
PHP Fatal error: Uncaught Magento\Framework\Exception\LocalizedException: The image type for the file is invalid. Enter the correct image type and try again. in /var/www/magento/vendor/magento/module-catalog/Model/Product/Gallery/Processor.php:164
Source class "\MagestyApps\WebImages\Model\AssetInterface" for "MagestyApps\WebImages\Model\AssetInterfaceFactory" generation does not exist.
Hello Once i am trying to run command on magento 2 php bin/magento s:d:c that time i am getting this error can you please solve this issue
Originally posted by @pathik1011 in #26 (comment)
the report ssh:
Interception cache generation... 6/9 [==================>---------] 66% 1 min 326.0 MiBErrors during compilation:
MagestyApps\WebImages\App\MediaRewrite
Incompatible argument type: Required type: string. Actual type: \MagestyApps\WebImages\App\mediaDirectory; File:
/var/www/magento2/vendor/magestyapps/module-web-images/App/MediaRewrite.php
Total Errors Count: 1
In Log.php line 92:
Error during compilation
ObjectManager isn't initialized
#0 /vendor/magento/framework/File/Mime.php(84): Magento\Framework\App\ObjectManager::getInstance()
#1 /pub/get.php(61): Magento\Framework\File\Mime->__construct()
When uploaded a SVG file and requested at the front-end we are receiving above PHP error. Any idea?
I installed this extension on a brand new magento-2.4.6-p3 and after install no image could be uploaded to product images and to media gallery. It even prevented images from being imported with tools like Firebear import-export. I disabled it and everything worked again.
Needless to say that I did all the things necessary to install it (upgrade etc....being a developer myself).
Hi there!
Is it possible to add feature to allow upload svgs and webPs to attributes swatches?
Everything works fine except this section.
hi
I Installed extension if you have watermark for base image doesn't show image and show magento thumbnail
i tested it with magento 2.4.5
To make sure the extensions is installed on M2 compatible versions only, the composer.json should include a dependency on the compatible M2 version. This prevents installing the extension on non-compatible versions.
Hi, I'm getting the following error when trying to upload a webp
image on my live site:
It seems to upload the image after that error, however, the thumbnail is broken.
image.webp was not uploaded.
Warning: call_user_func() expects parameter 1 to be a valid callback, function 'imagecreatefromwebp' not found or invalid function name in /var/www_m2/site.co.uk/releases/3134dd48-4b49-4c52-9235-d3d75892f2d3/vendor/magestyapps/module-web-images/Model/Image/Adapter/Gd2Rewrite.php on line 80`
magestyapps/module-web-images: 1.1.6
magento/product-community-edition: 2.4.3-p2
At the moment the extension works with the Magento UI and the import function, but doesn't support Web API.
At the moment the Web API return that this MIME image is not supported.
It would be a great feature for this module.
Would it be possible to update this module to include PDFs? They are not images, but would be very useful.
if ($transparentIndex >= 0 && $transparentIndex <= imagecolorstotal($this->_imageHandler)) {
Maybe it should be changed to:
if ($transparentIndex >= 0 && $transparentIndex < imagecolorstotal($this->_imageHandler)) {
I have installed version 1.1.2(magestyapps/module-web-images) of this module to Magento 2.3.4. Only problem is that after resize pictures are black and white. Is there fully working version for Magento 2.3.4 ? Or somebody has similar problem. Magento2 is using GD to resize I think.
After uploading a webp product picture with a transparent background, the product picture is transformed to a picture with a white background.
Hello,
Thank you for this great plugin :)
The upload works well, but unfortunately product images are not generated when a (PNG) watermark is used, we have the following error : Unsupported watermark image format.
In order to solve that we added the missing callbacks to the Gd2Rewrite class :
private static $_callbacks = [ IMAGETYPE_GIF => ['output' => 'imagegif', 'create' => 'imagecreatefromgif'], // Fixes watermark IMAGETYPE_JPEG => ['output' => 'imagejpeg', 'create' => 'imagecreatefromjpeg'], // Fixes watermark IMAGETYPE_PNG => ['output' => 'imagepng', 'create' => 'imagecreatefrompng'], // Fixes watermark IMAGETYPE_XBM => ['output' => 'imagexbm', 'create' => 'imagecreatefromxbm'], // Fixes watermark IMAGETYPE_WBMP => ['output' => 'imagewbmp', 'create' => 'imagecreatefromxbm'], // Fixes watermark IMAGETYPE_WEBP => ['output' => 'imagewebp', 'create' => 'imagecreatefromwebp'], ];
It seems to work but now the thumbnail seems much more lighter than the original image, maybe it is a problem due to the watermark ?
Thank you for your help :)
Mathieu.
Hello,
How can I update this plugin so that I can also upload avif images?
Thank you
Hello. Sharing Amasti extensions gives an error.
ext Amasty_Base, Amasty_ShopbyBrand
1 exception(s):
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): The attribute with a "attr_manufacturer" attributeCode doesn't exist. Verify the attribute and try again.
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): The attribute with a "attr_manufacturer" attributeCode doesn't exist. Verify the attribute and try again.
#1 Magento\Catalog\Model\Product\Attribute\Repository->get() called at [vendor/magento/framework/Interception/Interceptor.php:58] #2 Magento\Catalog\Model\Product\Attribute\Repository\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #3 Magento\Catalog\Model\Product\Attribute\Repository\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #4 Magento\Catalog\Model\Product\Attribute\Repository\Interceptor->___callPlugins() called at [generated/code/Magento/Catalog/Model/Product/Attribute/Repository/Interceptor.php:23] #5 Magento\Catalog\Model\Product\Attribute\Repository\Interceptor->get() called at [vendor/amasty/module-shop-by-base/Model/OptionSetting.php:689] #6 Amasty\ShopbyBase\Model\OptionSetting->getAttributeOptions() called at [vendor/amasty/module-shop-by-base/Model/OptionSetting.php:672] #7 Amasty\ShopbyBase\Model\OptionSetting->getAttributeOption() called at [vendor/amasty/module-shop-by-brand/ViewModel/OptionProcessor.php:69] #8 Amasty\ShopbyBrand\ViewModel\OptionProcessor->process() called at [vendor/amasty/module-shop-by-base/Block/Product/AttributeIcon.php:119] #9 Amasty\ShopbyBase\Block\Product\AttributeIcon->getOptionsData() called at [vendor/amasty/module-shop-by-base/view/frontend/templates/attribute/icon.phtml:11] #10 include() called at [vendor/magento/framework/View/TemplateEngine/Php.php:71] #11 Magento\Framework\View\TemplateEngine\Php->render() called at [vendor/magento/framework/Interception/Interceptor.php:58] #12 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #13 Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/amasty/module-fpc-warmer/Plugin/Holepunch/TemplateRenderer.php:52] #14 Amasty\Fpc\Plugin\Holepunch\TemplateRenderer->aroundRender() called at [vendor/magento/framework/Interception/Interceptor.php:135] #15 Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #16 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php:23] #17 Magento\Framework\View\TemplateEngine\Php\Interceptor->render() called at [vendor/magento/framework/View/Element/Template.php:273] #18 Magento\Framework\View\Element\Template->fetchView() called at [vendor/magento/framework/View/Element/Template.php:303] #19 Magento\Framework\View\Element\Template->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1111] #20 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [vendor/magento/framework/Cache/LockGuardedCacheLoader.php:136] #21 Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1133] #22 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:675] #23 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [vendor/amasty/module-shop-by-brand/Plugin/Catalog/Block/Product/View/BlockHtmlTitlePlugin.php:77] #24 Amasty\ShopbyBrand\Plugin\Catalog\Block\Product\View\BlockHtmlTitlePlugin->generateLogoHtml() called at [vendor/amasty/module-shop-by-brand/Plugin/Catalog/Block/Product/View/BlockHtmlTitlePlugin.php:51] #25 Amasty\ShopbyBrand\Plugin\Catalog\Block\Product\View\BlockHtmlTitlePlugin->afterToHtml() called at [vendor/magento/framework/Interception/Interceptor.php:146] #26 Amasty\Mage24Fix\Block\Theme\Html\Title\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #27 Amasty\Mage24Fix\Block\Theme\Html\Title\Interceptor->___callPlugins() called at [generated/code/Amasty/Mage24Fix/Block/Theme/Html/Title/Interceptor.php:329] #28 Amasty\Mage24Fix\Block\Theme\Html\Title\Interceptor->toHtml() called at [vendor/magento/framework/View/Layout.php:578] #29 Magento\Framework\View\Layout->_renderBlock() called at [vendor/magento/framework/View/Layout.php:555] #30 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #31 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #32 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #33 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:606] #34 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557] #35 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #36 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #37 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #38 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:606] #39 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557] #40 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #41 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #42 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #43 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:606] #44 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557] #45 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #46 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #47 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #48 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:606] #49 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557] #50 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #51 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #52 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #53 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:606] #54 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557] #55 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #56 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #57 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #58 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:606] #59 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557] #60 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #61 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #62 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #63 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:606] #64 Magento\Framework\View\Layout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557] #65 Magento\Framework\View\Layout->renderNonCachedElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:149] #66 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510] #67 Magento\Framework\View\Layout->renderElement() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:140] #68 Magento\Framework\View\Layout\Interceptor->renderElement() called at [vendor/magento/framework/View/Layout.php:975] #69 Magento\Framework\View\Layout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58] #70 Magento\Framework\View\Layout\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #71 Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #72 Magento\Framework\View\Layout\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:347] #73 Magento\Framework\View\Layout\Interceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258] #74 Magento\Framework\View\Result\Page->render() called at [vendor/magento/framework/View/Result/Layout.php:171] #75 Magento\Framework\View\Result\Layout->renderResult() called at [vendor/magento/framework/Interception/Interceptor.php:58] #76 Magento\Framework\View\Result\Page\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #77 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #78 Magento\Framework\View\Result\Page\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:95] #79 Magento\Framework\View\Result\Page\Interceptor->renderResult() called at [vendor/magento/framework/App/Http.php:120] #80 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23] #81 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:263] #82 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:29]
Hey
Nice work! Thanks for sharing!
Found that module doesn't work in M2.4.5 running php8.1
in vendor/magestyapps/module-web-images/Plugin/File/Validator/NotProtectedExtensionPlugin.php
around line 40 before foreach loop add:
$result = is_string($result) ? explode(",", $result) : $result;
How do I allow WebP Images Upload as mentioned in Module Description?
I m getting this error message File validation failed
when I tried to upload a svg file to a static block.
I m running Magento 2.4.2 and the module version is 1.0.1
Could you please have a look ? Thanks
I have installed your extension, when I add .webp image in product images it works nice. At the PDP when you swipe and open webp picture it is not showing properly. It is colourless sometimes and some webp images are blur. Please share your thought about that. Is that an extension issue? or magento issue or what?
Waiting for the reply..
Dear,
After compiling a M 2.4.3-p1 with 1.1.3, I encounter and issue regarding the argument type : string vs file
Interception cache generation... 6/9 [==================>---------] 66% 42 secs 610.0 MiBErrors during compilation: MagestyApps\WebImages\Model\File\Uploader Incompatible argument type: Required type: string. Actual type: \MagestyApps\WebImages\Model\File\fileId; File: /var/www/vhosts/------/src/vendor/magestyapps/module-web-images/Model/File/Uploader.php
It's compiling fine with 1.1.2
Regards
Magento: 2.4.6-p3
PHP: 8.1.2
Apache: 2.4.52
module-web-images: 1.1.9
Neither SVG or WebP images upload to the Media Gallery.
I get the standard error message, e.g. "Magento.svg: File validation failed."
Elsewhere images upload correctly it's just the Media Gallery.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.