I was checking out imageoptim today, and really would love to run this from php on my linux server. Is that possible?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With