matjazpotocnik / AutoSmush

Automatically optimize images on upload/resize/crop. Manual and bulk optimization.
MIT License
11 stars 0 forks source link

Getting Command "jpegoptim" not found error #1

Closed lesaff closed 7 years ago

lesaff commented 8 years ago

I am getting Command "jpegoptim" not found error when I uploaded an image even though I have jpegoptim installed.

rudy$ jpegoptim -V
jpegoptim v1.4.4  x86_64-apple-darwin15.6.0
Copyright (c) 1996-2016, Timo Kokkonen

libjpeg version: 8d  15-Jan-2012
Copyright (C) 2012, Thomas G. Lane, Guido Vollbeding
rudy$ which jpegoptim
/usr/local/bin/jpegoptim

Update: same goes to pngquant when uploading PNG file

rudy$ which pngquant
/usr/local/bin/pngquant
matjazpotocnik commented 8 years ago

This has actually nothing to do with AutoSmush. Error is thrown because OptimizerFactory can't find executable. I would check safe mode directive in php.ini. When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have .. components in the path to the executable. Also, user running your webserver (apache?) must have access to the executable.

matjazpotocnik commented 8 years ago

Also check my answer here: https://processwire.com/talk/topic/14818-auto-smush/?do=findComment&comment=133382

lesaff commented 8 years ago

That works! I am on MacOS and installed all the local optimization tools via brew, so most likely they all will be stored in /usr/local/bin

For other people watching this thread, use which jpegoptim to find the correct path in *nix systems

matjazpotocnik commented 8 years ago

Great! Would you mind adding more information about changing the path on MacOS? Or did you just copied the files to the "right" location?