]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/img.pm
web commit by JoshTriplett: asprintf and glibc
[git.ikiwiki.info.git] / IkiWiki / Plugin / img.pm
index b1c9db80c969055edc59227b5c79d83945b7b911..a453a49ba43321c1261ae12db846c1c3adb88c5e 100644 (file)
@@ -62,7 +62,7 @@ sub preprocess (@) { #{{{
                        return "[[img ".sprintf(gettext("failed to read %s: %s"), $file, $r)."]]" if $r;
 
                        $r = $im->Resize(geometry => "${w}x${h}");
-                       return "[[img ".sprinftf(gettext("failed to resize: %s"), $r)."]]" if $r;
+                       return "[[img ".sprintf(gettext("failed to resize: %s"), $r)."]]" if $r;
 
                        # don't actually write file in preview mode
                        if (! $params{preview}) {
@@ -98,7 +98,10 @@ sub preprocess (@) { #{{{
 
        return '<a href="'.$fileurl.'"><img src="'.$imgurl.
                '" alt="'.$alt.'" width="'.$im->Get("width").
-               '" height="'.$im->Get("height").'" /></a>';
+               '" height="'.$im->Get("height").'"'.
+               (exists $params{class} ? ' class="'.$params{class}.'"' : '').
+               (exists $params{id} ? ' id="'.$params{id}.'"' : '').
+               ' /></a>';
 } #}}}
 
 1