X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/0ccf21daafa76fd182df5e6bc156f22873fe062d..c321f5406b29e29b6ff61ab9e291a24d68e9d824:/IkiWiki/Plugin/img.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 63dfa9019..2375ead89 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -39,7 +39,7 @@ sub preprocess (@) { } } - if (! exists $params{size}) { + if (! exists $params{size} || ! length $params{size}) { $params{size}='full'; } @@ -121,7 +121,8 @@ sub preprocess (@) { $r = $im->Resize(geometry => "${w}x${h}"); error sprintf(gettext("failed to resize: %s"), $r) if $r; - # don't actually write file in preview mode + # don't actually write resized file in preview mode; + # rely on width and height settings if (! $params{preview}) { my @blob = $im->ImageToBlob(); writefile($imglink, $config{destdir}, $blob[0], 1); @@ -155,14 +156,25 @@ sub preprocess (@) { $imgurl="$config{url}/$imglink"; } + if (exists $params{class}) { + $params{class}.=" img"; + } + else { + $params{class}="img"; + } + + my $attrs=''; + foreach my $attr (qw{alt title class id hspace vspace}) { + if (exists $params{$attr}) { + $attrs.=" $attr=\"$params{$attr}\""; + } + } + my $imgtag=''.$params{alt}.''; my $link;