]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/img.pm
When editing a page, show that page's sidebar. (Thanks, privat)
[ikiwiki.git] / IkiWiki / Plugin / img.pm
index 82db15a7ea3a6b5cf47b1cb93010792e765479fc..63dfa901909f358daf20a9975f00386749dcc747 100644 (file)
@@ -19,6 +19,7 @@ sub getsetup () {
                plugin => {
                        safe => 1,
                        rebuild => undef,
+                       section => "widget",
                },
 }
 
@@ -114,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);
@@ -132,6 +130,9 @@ sub preprocess (@) {
                                        $imglink = $file;
                                }
                        }
+                       
+                       $dwidth = $im->Get("width") unless defined $dwidth;
+                       $dheight = $im->Get("height") unless defined $dheight;
                }
        }
        else {