Browse Source

handle images without maxWidth or maxHeight

master
Pascal Gloor 5 years ago
parent
commit
fb7a8e97d1
1 changed files with 22 additions and 6 deletions
  1. 22
    6
      cgi/autodoc.fcgi

+ 22
- 6
cgi/autodoc.fcgi View File

@@ -261,6 +261,16 @@ sub get_page_image {
$conf->{path}{global}, $conf->{path}{cache}, $wh, $size);
}
}
else {
if ( defined $id ) {
$dst = sprintf("%s/%s/%s.jpeg",
$conf->{path}{global}, $conf->{path}{cache}, $id);
}
else {
$dst = sprintf("%s/%s/error_img.jpeg",
$conf->{path}{global}, $conf->{path}{cache});
}
}

my $imgfile;

@@ -269,12 +279,18 @@ sub get_page_image {
}
else {
if ( ! -r $dst ) {
my $cmd = sprintf("convert %s -resize %s%s %s",
$src,
$wh eq 'h' ? 'x' : '',
$size,
$dst
);
my $cmd;
if ( defined $wh && defined $size ) {
$cmd = sprintf("convert %s -resize %s%s %s",
$src,
$wh eq 'h' ? 'x' : '',
$size,
$dst
);
}
else {
$cmd sprintf("cp %s %s", $src, $dst);
}
print STDERR "CMD=$cmd\n";
system($cmd);
}

Loading…
Cancel
Save