summaryrefslogtreecommitdiff
path: root/bin/gen-xhtml-thumbnails
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-02-06 19:02:46 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2010-02-06 19:02:46 +0100
commitd57b71bc36a41210f9e4016682c4651f2d5e60b8 (patch)
tree5807c16d18d0ebc4b5eef57c223dc8a018e60193 /bin/gen-xhtml-thumbnails
parentea1d01e91689fec7f567ba0f4c2e81429a8ee88b (diff)
Don't resize images which are smaller than the thumbnail size
Diffstat (limited to 'bin/gen-xhtml-thumbnails')
-rwxr-xr-xbin/gen-xhtml-thumbnails14
1 files 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);