image-optimizer.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use Spatie\ImageOptimizer\Optimizers\Gifsicle;
  3. use Spatie\ImageOptimizer\Optimizers\Jpegoptim;
  4. use Spatie\ImageOptimizer\Optimizers\Optipng;
  5. use Spatie\ImageOptimizer\Optimizers\Pngquant;
  6. use Spatie\ImageOptimizer\Optimizers\Svgo;
  7. return [
  8. /*
  9. * When calling `optimize` the package will automatically determine which optimizers
  10. * should run for the given image.
  11. */
  12. 'optimizers' => [
  13. Jpegoptim::class => [
  14. '-m' . (int) env('IMAGE_QUALITY', 80),
  15. '--strip-all', // this strips out all text information such as comments and EXIF data
  16. '--all-progressive', // this will make sure the resulting image is a progressive one
  17. ],
  18. Pngquant::class => [
  19. '--force', // required parameter for this package
  20. ],
  21. Optipng::class => [
  22. '-i0', // this will result in a non-interlaced, progressive scanned image
  23. '-o7', // this set the optimization level to two (multiple IDAT compression trials)
  24. '-strip all',
  25. '-quiet', // required parameter for this package
  26. ],
  27. Svgo::class => [
  28. '--disable=cleanupIDs', // disabling because it is know to cause troubles
  29. ],
  30. Gifsicle::class => [
  31. '-b', // required parameter for this package
  32. '-O3', // this produces the slowest but best results
  33. ],
  34. ],
  35. /*
  36. * The maximum time in seconds each optimizer is allowed to run separately.
  37. */
  38. 'timeout' => 59,
  39. /*
  40. * If set to `true` all output of the optimizer binaries will be appended to the default log.
  41. * You can also set this to a class that implements `Psr\Log\LoggerInterface`.
  42. */
  43. 'log_optimizer_activity' => false,
  44. ];