From 0ccf21daafa76fd182df5e6bc156f22873fe062d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 8 Jun 2010 21:13:37 -0400 Subject: img: Fill in missing height or width when scaling image. --- IkiWiki/Plugin/img.pm | 6 +++--- debian/changelog | 1 + doc/bugs/img_plugin_and_missing_heigth_value.mdwn | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index f06121578..63dfa9019 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -115,9 +115,6 @@ sub preprocess (@) { $im = Image::Magick->new; $r = $im->Read($outfile); error sprintf(gettext("failed to read %s: %s"), $outfile, $r) if $r; - - $dwidth = $im->Get("width"); - $dheight = $im->Get("height"); } else { ($dwidth, $dheight)=($w, $h); @@ -133,6 +130,9 @@ sub preprocess (@) { $imglink = $file; } } + + $dwidth = $im->Get("width") unless defined $dwidth; + $dheight = $im->Get("height") unless defined $dheight; } } else { diff --git a/debian/changelog b/debian/changelog index 0a7d17eb7..9a10332ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ ikiwiki (3.20100518.3) UNRELEASED; urgency=low * creation_day() etc use local time, not gmtime. To match calendars, which use local time. + * img: Fill in missing height or width when scaling image. -- Joey Hess Mon, 31 May 2010 20:44:17 -0400 diff --git a/doc/bugs/img_plugin_and_missing_heigth_value.mdwn b/doc/bugs/img_plugin_and_missing_heigth_value.mdwn index a82e2a7d7..bcb17c330 100644 --- a/doc/bugs/img_plugin_and_missing_heigth_value.mdwn +++ b/doc/bugs/img_plugin_and_missing_heigth_value.mdwn @@ -1,3 +1,5 @@ When I set up my picture page with `\[[!img defaults size=300x]]` then the html validator complains that the value for height is missing and the IE browsers won't show the pictures up at all; no problems with ff tho. If I set up my picture page with `\[[!img defaults size=300x300]]` then all the images are funny stretched. What am I doing wrong? > This is a bug. --[[Joey]] + +> And .. [[fixed|done]] --[[Joey]] -- cgit v1.2.3