Skip to content

Commit

Permalink
Fix regression in resizing JPEG images with Imagick (#5376)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Jul 29, 2016
1 parent 672ca96 commit 2f2765a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ CHANGELOG Roundcube Webmail
- Managesieve: Unhide advanced rule controls if there are inputs with errors
- Managesieve: Display warning message when filter form contains errors
- Enigma: Add possibility to configure gpg-agent binary location (enigma_pgp_agent)
- Fix regression in resizing JPEG images with Imagick (#5376)

RELEASE 1.2.1
-------------
Expand Down
12 changes: 9 additions & 3 deletions program/lib/Roundcube/rcube_image.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,15 @@ public function resize($size, $filename = null, $browser_compat = false)
try {
$image = new Imagick($this->image_file);

$image->setImageBackgroundColor('white');
$image->setImageAlphaChannel(11);
$image->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
try {
// it throws exception on formats not supporting these features
$image->setImageBackgroundColor('white');
$image->setImageAlphaChannel(11);
$image->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
}
catch (Exception $e) {
// ignore errors
}

$image->setImageColorspace(Imagick::COLORSPACE_SRGB);
$image->setImageCompressionQuality(75);
Expand Down

0 comments on commit 2f2765a

Please sign in to comment.