PHP code example of hgati / magento2-webp-convert

1. Go to this page and download the library: Download hgati/magento2-webp-convert library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hgati / magento2-webp-convert example snippets

shell script
    echo "Installing vips library"
    sudo apt-get install libvips-dev
    
    echo "Installing vips pecl extension"
    $PHP_VER=8.2
    printf "\n" | sudo pecl install vips
    
    [ -d /etc/php/$PHP_VER/mods-available ] && echo 'extension=vips.so' | sudo tee /etc/php/$PHP_VER/mods-available/vips.ini
    [ -d /etc/php/$PHP_VER/mods-available ] && sudo ln -sf /etc/php/$PHP_VER/mods-available/vips.ini /etc/php/$PHP_VER/fpm/conf.d/20-vips.ini
    [ -d /etc/php/$PHP_VER/mods-available ] && sudo ln -sf /etc/php/$PHP_VER/mods-available/vips.ini /etc/php/$PHP_VER/cli/conf.d/20-vips.ini
    # OR Add `extension=vips.so` to **php.ini** file.
    
shell  
    composer gento module:enable Hgati_Webp
    
    php bin/magento setup:upgrade
    
    php bin/magento setup:di:compile
    
    php bin/magento setup:static-content:deploy -f