How to run imageoptim from php on linux? How to run imageoptim from php on linux? linux linux

How to run imageoptim from php on linux?


imageoptim is Mac OS X only. On there website they recommend trimage for non Mac users.

In order to call external programs from php you use the exec command documented here.

Note that for security reasons it is important to escape arguments passed to exec with another command like escapeshellcmd or escapeshellarg for security reasons.

Your assumption in the comment about command line options is correct, you just pass them along with the program name as the string argument to exec with proper escaping of course.


ImageOptim is no longer OS X-only. Now you can use the ImageOptim Web API on any platform.