The deprecated use of Graphics::Magick has been eliminated. WebGUI uses

Image::Magick exclusively for all image processing functions once again.
This commit is contained in:
JT Smith 2008-11-26 17:00:26 +00:00
parent 04f2388ef8
commit 782a4396b5
4 changed files with 6 additions and 39 deletions

View file

@ -83,7 +83,6 @@ checkModule("Time::HiRes", 1.38 );
checkModule("DateTime::Format::Strptime", 1.0601 ); checkModule("DateTime::Format::Strptime", 1.0601 );
checkModule("DateTime::Format::Mail", 0.2901 ); checkModule("DateTime::Format::Mail", 0.2901 );
checkModule("Image::Magick", "6.0", 2 ); checkModule("Image::Magick", "6.0", 2 );
checkModule("Graphics::Magick", "1.1.7", 2 );
checkModule("Log::Log4perl", 0.51 ); checkModule("Log::Log4perl", 0.51 );
checkModule("Net::LDAP", 0.25 ); checkModule("Net::LDAP", 0.25 );
checkModule("HTML::Highlight", 0.20 ); checkModule("HTML::Highlight", 0.20 );

View file

@ -20,24 +20,12 @@ BEGIN {
# thumbnails. # thumbnails.
#----------------------------------------- #-----------------------------------------
use Carp qw(croak);
use File::stat; use File::stat;
use File::Find (); use File::Find ();
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use Image::Magick;
my $graphicsPackage;
BEGIN {
if (eval { require Graphics::Magick; 1 }) {
$graphicsPackage = 'Graphics::Magick';
}
elsif (eval { require Image::Magick; 1 }) {
$graphicsPackage = 'Image::Magick';
}
else {
croak "You must have either Graphics::Magick or Image::Magick installed to run WebGUI.\n";
}
}
use WebGUI::Utility; use WebGUI::Utility;
@ -82,7 +70,7 @@ sub createThumbnail {
my ($image, $x, $y, $r, $n, $type); my ($image, $x, $y, $r, $n, $type);
my ($fileName, $fileDir) = @_; my ($fileName, $fileDir) = @_;
print "Nailing: $fileDir/$fileName\n"; print "Nailing: $fileDir/$fileName\n";
$image = $graphicsPackage->new; $image = Image::Magick->new;
$image->Read($fileName); $image->Read($fileName);
($x, $y) = $image->Get('width','height'); ($x, $y) = $image->Get('width','height');
$r = $x>$y ? $x / $thumbnailSize : $y / $thumbnailSize; $r = $x>$y ? $x / $thumbnailSize : $y / $thumbnailSize;
@ -144,7 +132,7 @@ have thumbnails, and create PNG thumbnails for the rest.
Files with JPG, JPEG, GIF, PNG, TIF, TIFF and BMP extensions are Files with JPG, JPEG, GIF, PNG, TIF, TIFF and BMP extensions are
regarded as graphic files. regarded as graphic files.
The thumbnails are created using L<Graphics::Magick> or L<Image::Magick> The thumbnails are created using L<Image::Magick>
for image transformations. for image transformations.
=over =over

View file

@ -19,15 +19,7 @@ use WebGUI::Test;
use WebGUI::Session; use WebGUI::Session;
use Test::More; use Test::More;
use Test::Deep; use Test::Deep;
my $graphicsClass; use Image::Magick;
BEGIN {
if (eval { require Image::Magick; 1 }) {
$graphicsClass = 'Image::Magick';
}
elsif (eval { require Graphics::Magick; 1 }) {
$graphicsClass = 'Graphics::Magick';
}
}
use WebGUI::Asset::File::GalleryFile::Photo; use WebGUI::Asset::File::GalleryFile::Photo;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------

View file

@ -17,23 +17,11 @@ use WebGUI::Macro::Thumbnail;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Image; use WebGUI::Image;
use WebGUI::Storage; use WebGUI::Storage;
use Image::Magick;
use Test::More; # increment this value for each test you create use Test::More; # increment this value for each test you create
use Test::Deep; use Test::Deep;
plan tests => 9; plan tests => 9;
my $graphicsPackage;
if (eval { require Graphics::Magick; 1 }) {
$graphicsPackage = 'Graphics::Magick';
}
elsif (eval { require Image::Magick; 1 }) {
$graphicsPackage = 'Image::Magick';
}
else {
die "Unable to load Graphics::Magick or Image::Magick!\n";
}
pass "Load $graphicsPackage";
my $session = WebGUI::Test->session; my $session = WebGUI::Test->session;
is( is(
@ -98,7 +86,7 @@ SKIP: {
##Load the image into some parser and check a few pixels to see if they're blue-ish. ##Load the image into some parser and check a few pixels to see if they're blue-ish.
##->Get('pixel[x,y]') hopefully returns color in hex triplets ##->Get('pixel[x,y]') hopefully returns color in hex triplets
my $thumbImg = $graphicsPackage->new(); my $thumbImg = Image::Magick->new();
$thumbImg->Read(filename => $thumbFile); $thumbImg->Read(filename => $thumbFile);
cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>25, y=>25, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #1'); cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>25, y=>25, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #1');