我的托管提供商最近升级了他们的服务器,我在使用perl中的imagemagick脚本时遇到了很多问题。我的脚本在旧服务器上完美运行,但在新服务器上失败了,所以我回到基础知识来尝试解决问题。
服务器报告的imagemagick版本为:
如果我将
服务器报告的imagemagick版本为:
Version: ImageMagick 6.7.2-2 2011-10-20 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
perl模块Image::Magick的版本为6.72。
以下脚本已保存在我的服务器上:
#!/usr/bin/perl
use CGI::Carp qw( fatalsToBrowser );
use Image::Magick;
my $image = Image::Magick->new;
$x = $image -> Set(size=>"200x200");
warn "$x" if "$x";
$x = $image -> ReadImage("canvas:black");
warn "$x" if "$x";
$x = $image -> Draw (
stroke => "red",
primitive => "line",
points => "20,20 180,180");
warn "$x" if "$x";
print "Content-type: image/gif\n\n";
binmode STDOUT;
$image -> write ("gif:-");
以下是出现的错误信息:
[Sun Oct 23 11:02:32 2011] imtest.pl: Exception 420: no decode delegate for this image format `lack' @ error/constitute.c/ReadImage/532 at www/11/cgi-bin/imtest.pl line 12.
[Sun Oct 23 11:02:32 2011] imtest.pl: Exception 410: no images defined `Draw' @ error/Magick.xs/XS_Image__Magick_Mogrify/7394 at www/11/cgi-bin/imtest.pl line 18.
如果我将
ReadImage("canvas:black")
更改为ReadImage("xc:black")
,那么脚本会持续运行但没有输出结果。我的网络主机一直在努力寻找解决方案,但我需要知道是否在这里做错了什么,或者是安装了imagemagick的问题。请注意,我意识到以上内容可以使用其他简单模块完成,但这只是一个简单的示例,以确定问题是imagemagick还是我的代码!谢谢您的帮助。祝好,Stu