PHP code example of typisttech / image-optimize-command
1. Go to this page and download the library: Download typisttech/image-optimize-command 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/ */
typisttech / image-optimize-command example snippets
use Spatie\ImageOptimizer\OptimizerChain;
add_filter('TypistTech/ImageOptimizeCommand/OptimizerChain', function (OptimizerChain $optimizerChain): OptimizerChain {
// Option A: Send messages to $optimizerChain.
$optimizerChain->setTimeout($xxx);
$optimizerChain->useLogger($yyy);
$optimizerChain->addOptimizer($zzz);
// Option B: Make a new $optimizerChain.
// See: https://github.com/spatie/image-optimizer/blob/master/src/OptimizerChainFactory.php
$optimizerChain = new OptimizerChain();
$optimizerChain->addOptimizer($zzz);
// Finally
return $optimizerChain;
});
use TypistTech\ImageOptimizeCommand\Operations\AttachmentImages\Backup;
use TypistTech\ImageOptimizeCommand\Operations\AttachmentImages\Restore;
add_filter('TypistTech/ImageOptimizeCommand/Operations/AttachmentImages/Backup', function (): Backup {
// TODO: You have to implement a null backup class.
return $myNullBackupObject;
});
add_filter('TypistTech/ImageOptimizeCommand/Operations/AttachmentImages/Restore', function (): Restore {
// TODO: You have to implement a null restore class.
return $myNullRestoreObject;
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.