RedHat9 下 Image-Magick的报错
RedHat9 下 Image-Magick的报错
Hi,All
由于项目需要,使用perl生成相片的缩略图。使用的Image-Magick的版本为6.3.3,Perl的版本为ActivePerl5.8.8. 对于同一段pl在Linux下老是报错,Windows下没有问题脚本如下 :
sub image_resize {
my ( $file, $globe_x, $globe_y ) = @_;
my ( $status ) = "resize_ok";
my $i = Image::Magick->new;
$i->Read($file);
$geometry = "geometry";
$i->Scale(geometry=>$geometry, width=>$globe_x, height=>$globe_y);
# print "Content-type: image/gif\n\n";
# binmode(STDOUT);
# $i->Write("gif:-");
$i->Write($file);
if( $! ){ $status = "resize_err" }
return $status ;
}
报错信息如下:
Can't locate object method "Write" via package "Exception 410: no images defined `Image::Magick'" (perhaps you forgot to load "Exception 410: no images defined `Image::Magick'"?) at /dev/config/OEM/perl_module/image_resize.pl line 143.
怀疑是Image-Magick的安装问题。在/opt/ActivePerl.../site/lib/目录中已经有Image:Magtick的pm包。
在安装PerlMagick时Make Test有如下提示:
[root@localhost PerlMagick]# make test
/bin/sh ../magick.sh PERL_DL_NONLAZY=1 /opt/ActivePerl-5.8/bin/perl-static "-MEx tUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/bzl ib/*.t t/jpeg/*.t t/png/*.t t/ps/*.t t/tiff/*.t t/x/*.t t/xfig/*.t t/zlib/*.t
t/blob............ok
t/bzlib/read......ok
t/bzlib/write.....ok
t/composite.......ok
t/filter..........ok
t/getattribute....ok
t/jpeg/read.......ok
t/jpeg/write......ok
t/montage.........ok
t/png/read-16.....ok
t/png/read........ok
t/png/write-16....ok
t/png/write.......ok
t/ps/read.........ok
t/ps/write........ok
t/read............FAILED test 9
Failed 1/45 tests, 97.78% okay
t/setattribute....ok
t/tiff/read.......ok
t/tiff/write......ok
t/write...........ok
t/x/read..........FAILED test 1
Failed 1/1 tests, 0.00% okay
t/x/write.........ok
t/xfig/read.......ok
t/zlib/read.......ok
t/zlib/write......ok
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/read.t 45 1 2.22% 9
t/x/read.t 1 1 100.00% 1
Failed 2/25 test scripts, 92.00% okay. 2/334 subtests failed, 99.40% okay.
此外由于Linux可能自动安装了一个Image-Magick。请看如下命令
[root@localhost image]# rpm -q ImageMagick
ImageMagick-5.4.7-10
[root@localhost image]# convert -version
Version: ImageMagick 6.3.3 04/28/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC
不知道是否有影响
由于是一个Perl新手同时也是Linux新手,实在不知道怎么解决,请各位大侠帮忙,不胜感激!