}
add_link($params{page}, $image);
+
# optimisation: detect scan mode, and avoid generating the image
if (! defined wantarray) {
return;
my $r;
if ($params{size} ne 'full') {
+ add_depends($params{page}, $image);
+
my ($w, $h) = ($params{size} =~ /^(\d*)x(\d*)$/);
error sprintf(gettext('wrong size format "%s" (should be WxH)'), $params{size})
unless (defined $w && defined $h &&
$imglink = $file;
}
- add_depends($imglink, $params{page});
-
my ($fileurl, $imgurl);
if (! $params{preview}) {
$fileurl=urlto($file, $params{destpage});
elsif ($params{link} =~ /^\w+:\/\//) {
$imgtag='<a href="'.$params{link}.'">'.$imgtag.'</a>';
}
- elsif (length bestlink($params{page}, $params{link})) {
- add_depends($params{page}, $params{link});
- $imgtag=htmllink($params{page}, $params{destpage},
- $params{link}, linktext => $imgtag,
- noimageinline => 1);
+ else {
+ my $b = bestlink($params{page}, $params{link});
+
+ if (length $b) {
+ add_depends($params{page}, $b);
+ $imgtag=htmllink($params{page}, $params{destpage},
+ $params{link}, linktext => $imgtag,
+ noimageinline => 1);
+ }
}
if (exists $params{caption}) {