greenrivers / webp
Greenrivers Webp
Installs: 33
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 1
Open Issues: 0
Type:magento2-module
Requires
- php: >=7.1.0
- jcupitt/vips: ~1.0.5
This package is not auto-updated.
Last update: 2025-03-19 02:33:52 UTC
README
Magento2 module for images conversion to webp format.
Requirements
- PHP >= 7.1
- Cwebp >= 0.5.2
- libvips >= 8.4.5
- Magento >= 2.3
- Memory limit >= 8GB
Installation
-
Webp support
sudo apt-get install libwebp-dev sudo apt-get install webp
You must also enable GD-support.
Make sure that You have this extension.
sudo apt-get install phpX-gd
Where x is PHP version (i. e. 7.1).
Next configure PHP to enable support for webp format.
--with-webp-dir=DIR
-
Vips extension
sudo apt-get install libvips-dev pecl install vips
Add
extension=vips.so
to php.ini file.composer require jcupitt/vips
-
Module
composer require greenrivers/webp php bin/magento module:enable Greenrivers_Webp php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f
-
Memory limit
Increase PHP memory limit to minimum 8GB.
To achieve this add in app/bootstrap.php:
php ini_set('memory_limit', '8192M');
Usage
Stores->Configuration->GREENRIVERS->Webp
- General->Enabled - module activation
- Settings->Algorithm - choose one from three method types
- Settings->Quality - quality of converted image
- Conversion->Convert images on product save - if selected, after uploaded images on product page and save product, images will be converted automatically
Content->Conversion
Convert now
On left side select catalogs in which images are to be converted.
On right side in Conversion tab determine extensions which images are to be converted.
Click Convert now button to start conversion.
Cron
On left side select catalogs in which images are to be converted.
On right side in Cron tab click Enable toggle to schedule convert in cron.
Determine cron frequency, time and extensions which images are to be converted.
Clear
Click Clear all button in Clear tab to remove all webp images.
Save
Click Save to remember settings also You have to clear cache after this.
Catalog->Products
Upload images in Images And Videos tab.
Update changes by click on Save button.
All images assigned to product should be converted.
Due to caching images sometimes requires to save product again for convert all images.
Sources
https://www.php.net/manual/en/image.installation.php
https://developers.google.com/speed/webp