diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f8b8bc099..c7590bbb9 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,8 +1,8 @@ 7.6.5 - fixed #8800: Errors in POD of Asset-related mix-in modules (Bernd Kalbfuß-Zimmermann) - fixed: Products imported into the Shelf have bad URLs - - Deprecated WebGUI::Storage::Image. WebGUI::Storage can now do everything - WebGUI::Storage::Image can do. + - Deprecated WebGUI::Storage::Image. WebGUI::Storage can now do everything WebGUI::Storage::Image can do. + - The deprecated use of Graphics::Magick has been eliminated. WebGUI uses Image::Magick exclusively for all image processing functions once again. - fixed: #9147: Misspellings in Account - fixed: #9148: Account: account links do not work - fixed: #9149: Account: default templates do not work right diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 88f99a2c3..c50a07686 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -7,6 +7,12 @@ upgrading from one version to the next, or even between multiple versions. Be sure to heed the warnings contained herein as they will save you many hours of grief. +7.6.5 +-------------------------------------------------------------------- + * The deprecated use of Graphics::Magick has been eliminated. WebGUI uses + Image::Magick exclusively for all image processing functions once again. + + 7.6.4 -------------------------------------------------------------------- * The user facing portions of WebGUI's profile, inbox, friends, and "invite diff --git a/lib/WebGUI/Image.pm b/lib/WebGUI/Image.pm index ec41435c7..390c274f7 100644 --- a/lib/WebGUI/Image.pm +++ b/lib/WebGUI/Image.pm @@ -2,20 +2,7 @@ package WebGUI::Image; use strict; use WebGUI::Image::Palette; -use Carp qw(croak); - -our $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 Image::Magick; =head1 NAME @@ -186,7 +173,7 @@ sub new { my $width = shift || 300; my $height = shift || 300; - my $img = $graphicsPackage->new( + my $img = Image::Magick->new( size => $width.'x'.$height, ); @@ -263,13 +250,7 @@ The height of the image in pixels. sub setImageHeight { my $self = shift; my $height = shift; - - if ($graphicsPackage eq 'Graphics::Magick') { - $self->image->Resize(height => $height); - } - else { - $self->image->Extent(height => $height); - } + $self->image->Extent(height => $height); $self->image->Colorize(fill => $self->getBackgroundColor); $self->{_properties}->{height} = $height; } @@ -289,12 +270,7 @@ Teh width of the image in pixels. sub setImageWidth { my $self = shift; my $width = shift; - if ($graphicsPackage eq 'Graphics::Magick') { - $self->image->Resize(width => $width); - } - else { - $self->image->Extent(width => $width); - } + $self->image->Extent(width => $width); $self->image->Colorize(fill => $self->getBackgroundColor); $self->{_properties}->{width} = $width; } @@ -417,13 +393,7 @@ sub text { my $anchorX = $properties{x}; my $anchorY = $properties{y}; - my %testProperties = %properties; - delete $testProperties{align}; - delete $testProperties{style}; - delete $testProperties{fill}; - delete $testProperties{alignHorizontal}; - delete $testProperties{alignVertical}; - my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $self->image->QueryFontMetrics(%testProperties); + my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $self->image->QueryMultilineFontMetrics(%properties); # Process horizontal alignment if ($properties{alignHorizontal} eq 'center') { diff --git a/lib/WebGUI/Image/Graph.pm b/lib/WebGUI/Image/Graph.pm index 2b1fee538..0bd611fb5 100644 --- a/lib/WebGUI/Image/Graph.pm +++ b/lib/WebGUI/Image/Graph.pm @@ -422,8 +422,8 @@ sub getLabelDimensions { my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $self->image->QueryFontMetrics( font => $self->getLabelFont->getFile, # stroke => $self->getLabelColor, -# fill => $self->getLabelColor, -# style => 'Normal', + fill => $self->getLabelColor, + style => 'Normal', pointsize => $self->getLabelFontSize, %$properties, text => $text,