X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/b9ba68208ebdb250dc4d4f8866cb834f5bd8764c..3401dc6110ac785c1df3f447d2f1de017be92538:/IkiWiki/Plugin/img.pm diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index a186abdfc..68b001671 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -44,6 +44,7 @@ sub preprocess (@) { } add_link($params{page}, $image); + # optimisation: detect scan mode, and avoid generating the image if (! defined wantarray) { return; @@ -65,8 +66,10 @@ sub preprocess (@) { my $r; if ($params{size} ne 'full') { + add_depends($params{page}, $image); + my ($w, $h) = ($params{size} =~ /^(\d*)x(\d*)$/); - error sprintf(gettext('bad size "%s"'), $params{size}) + error sprintf(gettext('wrong size format "%s" (should be WxH)'), $params{size}) unless (defined $w && defined $h && (length $w || length $h)); @@ -102,8 +105,6 @@ sub preprocess (@) { $imglink = $file; } - add_depends($imglink, $params{page}); - my ($fileurl, $imgurl); if (! $params{preview}) { $fileurl=urlto($file, $params{destpage}); @@ -123,6 +124,7 @@ sub preprocess (@) { '" height="'.$im->Get("height").'"'. (exists $params{alt} ? ' alt="'.$params{alt}.'"' : ''). (exists $params{title} ? ' title="'.$params{title}.'"' : ''). + (exists $params{align} ? ' align="'.$params{align}.'"' : ''). (exists $params{class} ? ' class="'.$params{class}.'"' : ''). (exists $params{id} ? ' id="'.$params{id}.'"' : ''). ' />';