approached / laravel-image-optimizer

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

Check if command exists #20

Open benjamindk opened 7 years ago

benjamindk commented 7 years ago

File: ImageOptimizer/Command.php@23 if(!is_executable($this->cmd)) {

It would be better if you check first with "which jpegoptim", becouse it can happen that command is accesible only with absolut path "/usr/bin/jpegoptiom".

approached commented 7 years ago

With config file you can configure the path of the command:

https://github.com/approached/laravel-image-optimizer/blob/master/config/imageoptimizer.php#L32

benjamindk commented 7 years ago

Thanx, but...

I have added to .env... JPEGOPTIM=/usr/bin/jpegoptim but cmd is not changed.

Then for test I have saved direct in config... 'jpegoptim_bin' => '/usr/bin/jpegoptim', and cmd is still not changed?

approached commented 7 years ago

@benjamindk can you post your full code?

ctf0 commented 7 years ago

@approached i was having the same problem till i found this ticket, as mostly the path will be either /usr/bin or /usr/local/bin. so maybe the package can check internally for both paths and use which exist and if non then it can throw the exception ?