]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/img.pm
* In img tag, allow link=no to disable link to full size image. Thanks,
[ikiwiki.git] / IkiWiki / Plugin / img.pm
index a453a49ba43321c1261ae12db846c1c3adb88c5e..c4e4a6f220beae57c19c239db73fa1ee624cd678 100644 (file)
@@ -96,12 +96,19 @@ sub preprocess (@) { #{{{
                return "[[img ".sprintf(gettext("failed to determine size of image %s"), $file)."]]";
        }
 
-       return '<a href="'.$fileurl.'"><img src="'.$imgurl.
+       my $imgtag='<img src="'.$imgurl.
                '" alt="'.$alt.'" width="'.$im->Get("width").
                '" height="'.$im->Get("height").'"'.
                (exists $params{class} ? ' class="'.$params{class}.'"' : '').
                (exists $params{id} ? ' id="'.$params{id}.'"' : '').
-               ' /></a>';
+               ' />';
+
+       if (! defined $params{link} || lc($params{link}) eq 'yes') {
+               return  '<a href="'.$fileurl.'">'.$imgtag.'</a>';
+       }
+       else {
+               return $imgtag;
+       }
 } #}}}
 
 1