I'm doing some ImageMagick stuff. Here is my command:
我在做一些ImageMagick的东西。这是我的命令:
/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.
这段代码羽毛并调整图像的大小。它在本地主机上运行良好(我在本地主机上使用xampp),在shell和php代码中都可以使用,并且在shell中的专用服务器上运行良好。
But, it doesn't work at all on dedicated server with php code. Here is my code:
但是,它在php代码专用服务器上根本不起作用。这是我的代码:
$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?
ImageMagick正确安装在服务器上,并且我在phpinfo()中看到它发生的原因,我应该怎么做?
1 个解决方案
#1
4
The command convert
may not be in the $PATH
environment variable being used by the web server. Use the full path to convert
:
命令转换可能不在web服务器使用的$PATH环境变量中。使用完整路径转换:
// 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
要找到转换的位置,从服务器上的shell执行。
$ which convert
#1
4
The command convert
may not be in the $PATH
environment variable being used by the web server. Use the full path to convert
:
命令转换可能不在web服务器使用的$PATH环境变量中。使用完整路径转换:
// 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
要找到转换的位置,从服务器上的shell执行。
$ which convert