approached / laravel-image-optimizer

[deprecated] Image optimizer for laravel
MIT License
152 stars 33 forks source link

Optimize images based on mime content instead of file extension. #16

Closed rdok-pigogo closed 7 years ago

rdok-pigogo commented 7 years ago

Fails when the image extension is different than mime type.

We have shops logo, given by external api.

Where, even though a file might have extension of type 'png', it's mime type is a 'gif'.

In those cases, the library throws an exception:

Command failed, return code: 25, command: /usr/bin/pngquant '--force' '--ext=.png' '--' '/home/vagrant/Code/pigogo/pigogo/public/user-assets/Files/stores/mg-manager.png' 1> /dev/null 2> /dev/null Dev note: Probably the image is a different type than that of file extension.

This pull request fixes this.

TODO:

approached commented 7 years ago

Really good solution.

Thank you for the contributing this package.