I'm doing some ImageMagick stuff. Here is my command:
/usr/bin/convert /home/setsail/public_html/microsite/images
/tmp/fe0e3b88601d254befc115ca6a50365b.png -alpha set -channel alpha -background none
-vignette 0x3 -resize 66x89 /home/setsail/public_html/microsite/images/oval_thumb
/77bda03b6358b89efbe747ae414bd75f.png
This code feathers and resizes the image. It works fine on localhost (I'm using xampp on localhost) both in the shell and in php code, and works fine on my dedicated server in the shell.
But, it doesn't work at all on dedicated server with php code. Here is my code:
$cmd = "convert ".realpath($temp1)." -alpha set -channel alpha -background none -vignette 0x3 resize ".$width."x".$height." ".$dest_img;
exec($cmd);
ImageMagick is properly installed on server and active as well as I see it in phpinfo() Any ideas why it's happening and what should i do?
The command convert
may not be in the $PATH
environment variable being used by the web server. Use the full path to convert
:
// Substitute the full path for /usr/bin
$cmd = "/usr/bin/convert ".realpath($temp1)." -alpha set -channel alpha -background none -vignette 0x3 resize ".$width."x".$height." ".$dest_img;
$results = array();
$return_code = NULL;
exec($cmd, $results, $return_code);
// Check the output of the command for error:
var_dump($results);
var_dump($return_code);
To find convert
's location, from a shell on your server do
$ which convert