From 886d8215b8237fd515d78abbc9b844abb08a2661 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 17 Apr 2007 22:00:59 +0000 Subject: [PATCH] Image::Magick->Scale does nothing if given dimensions < 1, so make sure they are large enough when generating thumbnails in Storage/Image.pm --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Storage/Image.pm | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 2c1ad067a..b4ac56888 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,6 +8,8 @@ http://www.plainblack.com/bugs/tracker/trouble-with-search-users - fix: Fixed an unhandled exception in Workflow/Activity/PurgeOldAssetRevisions.pm - Added better error handling for asset instanciation in version tags. + - fix: Image::Magick->Scale does nothing if given dimensions < 1, so make sure + they are large enough when generating thumbnails in Storage/Image.pm 7.3.14 diff --git a/lib/WebGUI/Storage/Image.pm b/lib/WebGUI/Storage/Image.pm index 6b2a08086..dc84d4c05 100644 --- a/lib/WebGUI/Storage/Image.pm +++ b/lib/WebGUI/Storage/Image.pm @@ -133,7 +133,11 @@ sub generateThumbnail { my $n = $thumbnailSize; if ($x > $n || $y > $n) { my $r = $x>$y ? $x / $n : $y / $n; - $image->Scale(width=>($x/$r),height=>($y/$r)); + $x /= $r; + $y /= $r; + if($x < 1) { $x = 1 } # Dimentions < 1 cause Scale to fail + if($y < 1) { $y = 1 } + $image->Scale(width=>$x,height=>$y); $image->Sharpen('0.0x1.0'); } $error = $image->Write($self->getPath.'/'.'thumb-'.$filename);