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}) {
my $imglink;
my $r = $im->Read($srcfile);
error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;
my $imglink;
my $r = $im->Read($srcfile);
error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;
$im = Image::Magick->new;
$r = $im->Read($outfile);
error sprintf(gettext("failed to read %s: %s"), $outfile, $r) if $r;
$im = Image::Magick->new;
$r = $im->Read($outfile);
error sprintf(gettext("failed to read %s: %s"), $outfile, $r) if $r;
$r = $im->Resize(geometry => "${w}x${h}");
error sprintf(gettext("failed to resize: %s"), $r) if $r;
$r = $im->Resize(geometry => "${w}x${h}");
error sprintf(gettext("failed to resize: %s"), $r) if $r;
if (! $params{preview}) {
my @blob = $im->ImageToBlob();
writefile($imglink, $config{destdir}, $blob[0], 1);
if (! $params{preview}) {
my @blob = $im->ImageToBlob();
writefile($imglink, $config{destdir}, $blob[0], 1);