X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/848ff1bf5e218c57cc738a85ed02d7e1396c1d22..e78a8c2834e7ad880ab45d26db3a952df8465493:/IkiWiki/Plugin/img.pm diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index d295b833b..68b001671 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -43,7 +43,8 @@ sub preprocess (@) { return ''; } - push @{$links{$params{page}}}, $image; + 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}); @@ -121,8 +122,9 @@ sub preprocess (@) { my $imgtag=''.$params{alt}.'';