From 2f2765ab43b8c062ef1636ee57b14a169d035ede Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 29 Jul 2016 09:05:12 +0200 Subject: [PATCH] Fix regression in resizing JPEG images with Imagick (#5376) --- CHANGELOG | 1 + program/lib/Roundcube/rcube_image.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 217925cba..5dcbd5360 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 ------------- diff --git a/program/lib/Roundcube/rcube_image.php b/program/lib/Roundcube/rcube_image.php index 95c3d41ac..9f442f90a 100644 --- a/program/lib/Roundcube/rcube_image.php +++ b/program/lib/Roundcube/rcube_image.php @@ -167,9 +167,15 @@ class rcube_image 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);