]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/img.pm
img: Fill in missing height or width when scaling image.
[git.ikiwiki.info.git] / IkiWiki / Plugin / img.pm
index f06121578266bedc92027a0624cd05a21cdf6c0f..63dfa901909f358daf20a9975f00386749dcc747 100644 (file)
@@ -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 {