From 782a4396b52db45c94020db61395e81faf2bfc9a Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 26 Nov 2008 17:00:26 +0000 Subject: [PATCH] The deprecated use of Graphics::Magick has been eliminated. WebGUI uses Image::Magick exclusively for all image processing functions once again. --- sbin/testEnvironment.pl | 1 - sbin/thumbnailer.pl | 18 +++--------------- .../File/GalleryFile/Photo/makeResolutions.t | 10 +--------- t/Macro/Thumbnail.t | 16 ++-------------- 4 files changed, 6 insertions(+), 39 deletions(-) diff --git a/sbin/testEnvironment.pl b/sbin/testEnvironment.pl index 52271d2b3..8c2660805 100644 --- a/sbin/testEnvironment.pl +++ b/sbin/testEnvironment.pl @@ -83,7 +83,6 @@ checkModule("Time::HiRes", 1.38 ); checkModule("DateTime::Format::Strptime", 1.0601 ); checkModule("DateTime::Format::Mail", 0.2901 ); checkModule("Image::Magick", "6.0", 2 ); -checkModule("Graphics::Magick", "1.1.7", 2 ); checkModule("Log::Log4perl", 0.51 ); checkModule("Net::LDAP", 0.25 ); checkModule("HTML::Highlight", 0.20 ); diff --git a/sbin/thumbnailer.pl b/sbin/thumbnailer.pl index 2a9092e43..10d508e1d 100644 --- a/sbin/thumbnailer.pl +++ b/sbin/thumbnailer.pl @@ -20,24 +20,12 @@ BEGIN { # thumbnails. #----------------------------------------- -use Carp qw(croak); use File::stat; use File::Find (); use Getopt::Long; 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; @@ -82,7 +70,7 @@ sub createThumbnail { my ($image, $x, $y, $r, $n, $type); my ($fileName, $fileDir) = @_; print "Nailing: $fileDir/$fileName\n"; - $image = $graphicsPackage->new; + $image = Image::Magick->new; $image->Read($fileName); ($x, $y) = $image->Get('width','height'); $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 regarded as graphic files. -The thumbnails are created using L or L +The thumbnails are created using L for image transformations. =over diff --git a/t/Asset/File/GalleryFile/Photo/makeResolutions.t b/t/Asset/File/GalleryFile/Photo/makeResolutions.t index 71c2967be..954389ff8 100644 --- a/t/Asset/File/GalleryFile/Photo/makeResolutions.t +++ b/t/Asset/File/GalleryFile/Photo/makeResolutions.t @@ -19,15 +19,7 @@ use WebGUI::Test; use WebGUI::Session; use Test::More; use Test::Deep; -my $graphicsClass; -BEGIN { - if (eval { require Image::Magick; 1 }) { - $graphicsClass = 'Image::Magick'; - } - elsif (eval { require Graphics::Magick; 1 }) { - $graphicsClass = 'Graphics::Magick'; - } -} +use Image::Magick; use WebGUI::Asset::File::GalleryFile::Photo; #---------------------------------------------------------------------------- diff --git a/t/Macro/Thumbnail.t b/t/Macro/Thumbnail.t index 1a6d0f7cf..8cd0575dd 100644 --- a/t/Macro/Thumbnail.t +++ b/t/Macro/Thumbnail.t @@ -17,23 +17,11 @@ use WebGUI::Macro::Thumbnail; use WebGUI::Session; use WebGUI::Image; use WebGUI::Storage; - +use Image::Magick; use Test::More; # increment this value for each test you create use Test::Deep; 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; is( @@ -98,7 +86,7 @@ SKIP: { ##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 - my $thumbImg = $graphicsPackage->new(); + my $thumbImg = Image::Magick->new(); $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');