From d57b71bc36a41210f9e4016682c4651f2d5e60b8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 6 Feb 2010 19:02:46 +0100 Subject: Don't resize images which are smaller than the thumbnail size --- bin/gen-xhtml-thumbnails | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/gen-xhtml-thumbnails b/bin/gen-xhtml-thumbnails index dc44ce7..155ba1f 100755 --- a/bin/gen-xhtml-thumbnails +++ b/bin/gen-xhtml-thumbnails @@ -104,10 +104,16 @@ foreach my $file (sort(@files)) { ($dx, $dy) = ($image->width, $image->height); - if ($dx > $dy) { - $thumb = $image->create_scaled_image(THUMB_MAX_DIM, 0); - } else { - $thumb = $image->create_scaled_image(0, THUMB_MAX_DIM); + if ($dx > THUMB_MAX_DIM and $dy > THUMB_MAX_DIM) { + if ($dx > $dy) { + $thumb = $image->create_scaled_image(THUMB_MAX_DIM, 0); + } + else { + $thumb = $image->create_scaled_image(0, THUMB_MAX_DIM); + } + } + else { + $thumb = $image; } $thumb->set_quality(THUMB_QUALITY); -- cgit v1.2.3