1. Go to this page and download the library: Download despark/image-purify 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/ */
[
// This is the chain config. You can define your own chain and feed it commands
'chains' => [
JpegChain::class => [ // Chains must be real classes which contains commands to be executed
'commands' => [
'mozJpeg' => [
'bin' => 'cjpeg', // Path to the executable. The lbrary tries to resolve it itself
'arguments' => ['-optimize', '-progressive'], // What arguments to run
'customClass' => MozJpeg::class, // If you want you can give custom class that must implements our CommandInterface
],
],
'first_only' => false, // If this is true only the first command will be executed
],
...
],
'suppress_errors' => false // If set to true exceptions will be catched and only logs will be written,
]);