In Perl, there are also system() and bactick operators. So, in the Perl code, right after the image is uploaded, I add a call to a php script:
Code: Select all
`/usr/bin/php /Users/php/acuweb_helpers/create_thumb.php $path $thumb_path`;$thumb_path is where I want to write the thumbnail file to
Now, the php script looks like this:
Code: Select all
<?php
$path = $argv[1];
$thumb_path = $argv[2];
exec("/usr/bin/sips --resampleWidth 60 $path --out $thumb_path", $output, $ret);
$stuff = implode(',',$output)."\n";
$string = "/usr/bin/sips --resampleWidth 60 $path --out $thumb_path"." ,returns: ".$ret."\n\n";
$handle = fopen('/Users/php/acuweb_helpers/out.txt', 'a');
fwrite($handle, $string);
fwrite($handle, $stuff);
fclose($handle);
?>So, the problem is that the exec() fails. I have checked permissions and they are wide open. I even modifed the command to be like this (to try and force the command to be executed as root user):
sudo -u root -S /usr/bin/sips --resampleWidth 60 $path --out $thumb_path < /etc/root.secret