Set your directories pathes that will be optimized in config/image-optimizer.php
'dirs' => [
public_path('media'), // all png/jpeg images in folder public/media will be optimized recursivelypublic_path('upload') => [
'types' => ['images/png'], // array of mime types, that will be optimized (now supported image/png and image/jpeg)'recursive' => false, // search images only in root directory (public/upload)
Run artisan command (or add to cron) with root priveleges (to avoid problems with permissions)
sudo php artisan image-optimizer:run
All files in your directories will be optimized with max optimization levels (takes some time).