Storage/Image: resize works with ImageMagick again. Add diagnostics to tests for easy debug

This commit is contained in:
Colin Kuskie 2007-12-19 18:04:50 +00:00
parent 182f3ecfae
commit 8d1e47a6ce
2 changed files with 15 additions and 9 deletions

View file

@ -382,14 +382,14 @@ sub resize {
$self->session->errorHandler->error("Couldn't read image for resizing: ".$error);
return 0;
}
my $geometry;
if (!$width || !$height) {
$geometry = $width || $height;
}
else {
$geometry = $width . "x" . $height;
my ($x, $y) = $image->Get('width','height');
if (!$height) { # proportional scale by width
$height = $width / $x * $y;
}
$image->Resize( geometry => $geometry, filter => "lanczos" );
elsif (!$width) { # proportional scale by height
$width = $height * $x / $y;
}
$image->Resize( height => $height, width => $width, filter => "lanczos" );
$error = $image->Write($self->getPath($filename));
if ($error) {
$self->session->errorHandler->error("Couldn't resize image: ".$error);