How to use ONLY optipng?
krakrock opened this issue · 5 comments
I want to use optipng instead of pngquant for PNG images. How can I do this in the code?
I edited the config file in /vendor/approached/laravel-image-optimizer/config
:
'transform_handler' => [
'png' => 'optipng',
'jpg' => 'jpegoptim',
'jpeg' => 'jpegoptim',
'gif' => 'gifsicle',
],
And I uncommented the lines for optipng
:
'optipng_bin' => '/usr/local/bin/optipng',
'optipng_options' => ['-o2', '-quiet'],
But when the optimizer runs, it still outputs the PNG using the pngquant
algorithms.
Hi @krakrock
it looks everything good.
Try to clear your config / cache. And then try to debug it.
I've cleared the config cache (with php artisan config:cache
), and on top of that, I completely uninstalled pngquant
(so I now only have optipng
), but now when I run the optimizer, it doesn't do anything to optimize the image. It remains the same size.
I have no idea why that not work.
But try like this:
dd(config('imageoptimizer.transform_handler'));
Can you post your full file with use statements to: http://laravel.io/bin
Huh, interesting:
It's still pngquant
.
What's the correct way of changing the config then? Do I change it directly under /vendor
? How do I refresh the cache properly?
Alright, I fixed the problem.
For some dumb ass reason, I was editing the config under /vendor
, when I should've edited it under /config
.