I was checking out imageoptim today, and really would love to run this from php on my linux server. Is that possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
execcommand documented here.Note that for security reasons it is important to escape arguments passed to
execwith another command likeescapeshellcmdorescapeshellargfor 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.