psliwa / image-optimizer

Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.
MIT License
909 stars 141 forks source link

how to run use it #27

Closed eliomain closed 7 years ago

eliomain commented 7 years ago

i cant use it . want to help

eliomain commented 7 years ago

i need a simple example

matjazpotocnik commented 7 years ago

Example is provided in the readme.

$factory = new \ImageOptimizer\OptimizerFactory();
$optimizer = $factory->get();

$filepath = /* path to image */; 

$optimizer->optimize($filepath);
//optimized file overwrites original one
psliwa commented 7 years ago

Thanks @matjazpotocnik, I am closing this issue.