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
Conflicts:

	program/lib/Roundcube/rcube_image.php
  • Loading branch information
alecpl committed Jul 29, 2016
1 parent 0ec4864 commit 654d4e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
===========================

- 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
14 changes: 10 additions & 4 deletions program/lib/Roundcube/rcube_image.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,16 @@ public function resize($size, $filename = null, $browser_compat = false)
else {
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 654d4e5

Please sign in to comment.