Add X13 WebP module for image conversion to next-generation formats

- Implemented the main module class with essential properties and methods.
- Added translation support for various user interface strings.
- Created XML configuration file for module versioning.
- Ensured compatibility with different PHP versions and PrestaShop versions.
This commit is contained in:
2025-10-16 21:30:24 +02:00
parent d220e35c31
commit 3b29a79921
235 changed files with 40220 additions and 189 deletions

View File

@@ -0,0 +1,3 @@
# Installing cwebp using official precompilations
Official precompilations are available [here](https://developers.google.com/speed/webp/docs/precompiled). Since `WebPConvert` compares each binary's checksum first, you will have to change the checksums hardcoded in `Converters/Cwebp.php` if you want to replace any of them. If you feel the need of using another binary, please let us know - chances are that it should be added to the project!

View File

@@ -0,0 +1,15 @@
# Installing FFMpeg
Its very easy.
# Ubuntu
Here is a tutorial for ubuntu: https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/
## GitHub actions workflow
As easy as adding this step to your workflow yaml:
```yaml
- name: Setup ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v1
```
docs: https://github.com/marketplace/actions/setup-ffmpeg

View File

@@ -0,0 +1,19 @@
# Installing Gd extension with WebP support
## Ubuntu 18.04
On Ubuntu 18.04, I did not have to do anything special to configure Gd for WebP support. The following worked right away:
```
sudo apt-get install php7.2-gd
```
## Ubuntu 16.04
The official page with installation instructions is [available here](http://il1.php.net/manual/en/image.installation.php)
In summary:
PHP 5.5.0:
To get WebP support for `gd` in PHP 5.5.0, PHP must be configured with the `--with-vpx-dir` flag.
PHP >7.0.0:
PHP has to be configured with the `--with-webp-dir` flag

View File

@@ -0,0 +1,40 @@
# Installing GMagick PHP extension with WebP support
See:
https://github.com/rosell-dk/webp-convert/issues/37
## MX-19.4
I succeeded by simply doing the following after installing graphicsmagick, libwebp and libwebp-dev:
```
sudo apt install php-gmagick
sudo service apache2 restart
```
Note: For some reason this disables the imagick extension. It seems they cannot both be installed at the same time.
## Ubuntu 18.04, using *PECL*
In Ubuntu 18.04, you will not have to do any special steps in order to compile with webp :)
1. Find out which version of PHP you are using and the location of the relevant php.ini file. Both of these can be obtained with `phpinfo();`
2. Find out which is the latest version of *gmagick* on pecl. https://pecl.php.net/package/gmagick
3. Do the following - but alter to use the info you just collected
```
sudo apt-get update
sudo apt-get install graphicsmagick gcc libgraphicsmagick1-dev php-pear php7.2-dev
sudo pecl install gmagick-2.0.5RC1
sudo echo "extension=gmagick.so" >> /etc/php/7.2/apache2/php.ini
sudo service apache2 restart
```
Notes:
- The php-pear contains *pecl*.
- *php7.2-dev* provides *phpize*, which is needed by pecl. Use *php7.1-dev*, if you are on PHP 7.1
- We do not simply do a `pecl install gmagick` because the latest package is in beta, and pecl would not allow. You should however be able to do *pecl install gmagick-beta*, which should install the latest beta.
- If you are on *fpm*, remember to restart that as well (ie `sudo service php7.2-fpm restart`)
## Plesk
https://support.plesk.com/hc/en-us/articles/115003511013-How-to-install-Gmagick-PHP-extension-on-Ubuntu-Debian-
## From source
https://duntuk.com/how-install-graphicsmagick-gmagick-php-extension

View File

@@ -0,0 +1,80 @@
# Installing Imagick extension with WebP support
## MX-19.4
I succeeded by simply doing the following after installing imagemagick, libwebp and libwebp-dev:
```
sudo apt install php-imagick
sudo service apache2 restart
```
## Ubuntu 16.04
In order to get imagick with WebP on Ubuntu 16.04, you (currently) need to:
1. [Compile libwebp from source](https://developers.google.com/speed/webp/docs/compiling)
2. [Compile imagemagick from source](https://www.imagemagick.org/script/install-source.php) (```./configure --with-webp=yes```)
3. Compile php-imagick from source, phpize it and add ```extension=/path/to/imagick.so``` to php.ini
## Ubuntu 18.04 (from source)
A simple `sudo apt-get install php-imagick` unfortunately does not give you webp support.
Again, you must:
### 1. Compile libwebp from source
Instructions are [here](https://developers.google.com/speed/webp/docs/compiling).
In short, you need to:
```
sudo apt-get install libjpeg-dev libpng-dev
wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz
tar xvzf libwebp-1.1.0.tar.gz
cd into the dir
./configure
make
sudo make install
```
### 2. Compile *imagemagick* from source, configured with *webp*
See tutorial [here](https://linuxconfig.org/how-to-install-imagemagick-7-on-ubuntu-18-04-linux), but configure with *webp* (`./configure --with-webp=yes`)
```
sudo apt-get update
sudo apt build-dep imagemagick
wget https://imagemagick.org/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd into the dir
./configure --with-webp=yes
sudo make
sudo make install
sudo ldconfig /usr/local/lib
sudo identify -version # to check if installed ok
make check # optional run in-depth check
```
Check it this way: `identify -list format | grep WEBP`
- It should print a line
### 3a. Install extension with pecl
First find out which version of PHP you are using and the location of the relevant *php.ini* file. Both of these can be obtained with `phpinfo();`. Next do the following (but alter to use the info you just collected):
```
sudo apt-get update
sudo apt-get install imagemagick gcc libmagickwand-dev php-pear php7.2-dev
sudo pecl install imagick
sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini
sudo service apache2 restart
```
Related:
https://askubuntu.com/questions/769396/how-to-install-imagemagick-for-php7-on-ubuntu-16-04
### 3b. Alternively to using pecl, compile php-imagick from source
https://github.com/mkoppanen/imagick
First find out which version of PHP you are using and the location of the relevant *php.ini* file. Both of these can be obtained with `phpinfo();`. Next do the following (but alter to use the info you just collected):
```
wget https://pecl.php.net/get/imagick-3.4.3.tgz
tar xvzf imagick-3.4.3.tgz
cd into the dir
sudo /usr/bin/phpize7.2 # note: find you version of phpize with locate phpize
./configure
make
make install
sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini
sudo service apache2 restart
```

View File

@@ -0,0 +1,35 @@
# Installing vips extension
### Step 1: Install the vips library
Follow the instructions on the [vips library github page](https://github.com/libvips/libvips/)
Don't forget to install required packages before running `./configure`:
```
sudo apt-get install libglib2.0-dev pkg-config build-essential libexpat1-dev libjpeg-dev libpng-dev libwebp-dev gobject-introspection libgs-dev
```
### Step 2: Install the vips extension
```
sudo pecl install vips
```
– And add the following to the relevant php.ini:
```
extension=vips
```
(or `extension=vips.so` if you are in older PHP)
The vips extension is btw [also on github](https://github.com/libvips/php-vips-ext):
## GitHub actions workflow
As easy as adding "vips" to the extensions for `setup-php@v2`:
```yaml
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: vips
```