my %imgdefaults;
sub import { #{{{
- hook(type => "preprocess", id => "img", call => \&preprocess);
+ hook(type => "preprocess", id => "img", call => \&preprocess, scan => 1);
} #}}}
sub preprocess (@) { #{{{
return '';
}
+ push @{$links{$params{page}}}, $image;
my $file = bestlink($params{page}, $image);
- if (! $file) {
- # TODO: this may not be right, depending on where the file is
- # created in the end
- add_depends($params{page}, $image);
- return "[[img ".sprintf(gettext("%s not found"), $image)."]]";
- }
- else {
- add_depends($params{page}, $file);
- }
-
- my $dir = IkiWiki::dirname($file);
+ my $dir = $params{page};
my $base = IkiWiki::basename($file);
eval q{use Image::Magick};
my $outfile = "$config{destdir}/$dir/${w}x${h}-$base";
$imglink = "$dir/${w}x${h}-$base";
-
+
will_render($params{page}, $imglink);
if (-e $outfile && (-M srcfile($file) >= -M $outfile)) {