execute_only_first_png_optimizer (default: true) - execute the first.%filename% (without extension and dot) and %ext% (extension withĭot) which will be replaced by values from original file. output_filepath_pattern (default: %basename%/%filename%%ext%) -ĭestination where optimized file will be stored.For example in someĬases optimizing may not be worth when it takes big amount of time. Want to have control how long optimizing lasts. single_optimizer_timeout_in_seconds (default: 60) - useful when you.Library will be looking for those binaries in few places, so if binaries are placed in standard places, it will be found This library is very smart, you do not have to configure paths to all binaries of libraries that are used by ImageOptimizer, When in your use case optimization fault should cause exception, ignore_errors option was created This behaviour is ok when you want to eventually optimize files Not installed, optimizer will not touch original file. optimized file overwrites original one Configurationīy default optimizer does not throw any exception, if file can not be optimized or optimizing library for given file is Using composer: composer require ps/image-optimizerīasic usage $factory = new \ ImageOptimizer\ OptimizerFactory() Thanks to ImageOptimizer and libraries that it uses, your image files can be 10%-70% smaller.
Virtual machine with all libraries installed, so you can check Vagrantfile how to install all those stuff. Project contains Vagrantfile that defines testing So before use it you should install proper libraries on your server. It uses optipng, pngquant, jpegoptim, svgo and few more libraries, This library is handy and very easy to use optimizer for image files.