if (exists $imgdefaults{$params{page}}) {
foreach my $key (keys %{$imgdefaults{$params{page}}}) {
if (! exists $params{$key}) {
if (exists $imgdefaults{$params{page}}) {
foreach my $key (keys %{$imgdefaults{$params{page}}}) {
if (! exists $params{$key}) {
# optimisation: detect scan mode, and avoid generating the image
if (! defined wantarray) {
# optimisation: detect scan mode, and avoid generating the image
if (! defined wantarray) {
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 &&
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 &&
'" height="'.$dheight.'"'.
(exists $params{alt} ? ' alt="'.$params{alt}.'"' : '').
(exists $params{title} ? ' title="'.$params{title}.'"' : '').
'" height="'.$dheight.'"'.
(exists $params{alt} ? ' alt="'.$params{alt}.'"' : '').
(exists $params{title} ? ' title="'.$params{title}.'"' : '').
$imgtag=htmllink($params{page}, $params{destpage},
$params{link}, linktext => $imgtag,
$imgtag=htmllink($params{page}, $params{destpage},
$params{link}, linktext => $imgtag,