PHP code example of ebski / image-compressor

1. Go to this page and download the library: Download ebski/image-compressor 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/ */

    

ebski / image-compressor example snippets




use Ebski\ImageCompressor\Compressors\WebpCompressor;
use Ebski\ImageCompressor\Quality;

public function example()
{
    $compressor = new WebpCompressor();
    $compressedImagePath = $compressor->compressImage('path_to_original_image', Quality::MEDIUM);
}