I am writing a php app to compress images on my server using jpegoptim. Currently I have installed jpegoptim on my machine (Ubuntu14.04) and its working fine on the terminal.
But when I try to run the following code in a php file on my local machine nothing happens.
<? php
$path_to_jpg_file = "dump/f.jpg";
$path_to_jpg_file = escapeshellarg($path_to_jpg_file);
$compressed_jpg_content = shell_exec("jpegoptim --max=75 --strip-all --all-progressive - < ".escapeshellarg($path_to_jpg_file));
?>
I think that php is unable to find the jpegoptim command and thus unable to process the query, and hence I need to install jpegoptim on the server.
How do I install jpegoptim on my "server"?
NOTE: all the directories have 777 permission
You can install it using this