From 537aaa3d0919eb20d626416b2e27b4303c4cf4ed Mon Sep 17 00:00:00 2001 From: fliespl Date: Sat, 9 Jul 2016 10:42:11 +0200 Subject: [PATCH] Remove deprecated function flattenImages flattenImages in imagick is deprecated since php 5.6. `PHP Deprecated: Imagick::flattenImages method is deprecated and it's use should be avoided ` Proposed solution works with imagick 3.1.0+. 11 is used as an alternative to `Imagick::ALPHACHANNEL_REMOVE` which was added in imagick 3.2.0. --- program/lib/Roundcube/rcube_image.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/program/lib/Roundcube/rcube_image.php b/program/lib/Roundcube/rcube_image.php index 78f6e6176..42640f448 100644 --- a/program/lib/Roundcube/rcube_image.php +++ b/program/lib/Roundcube/rcube_image.php @@ -166,7 +166,10 @@ class rcube_image else { try { $image = new Imagick($this->image_file); - $image = $image->flattenImages(); + + $image->setImageBackgroundColor('white'); + $image->setImageAlphaChannel(11); + $image->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN); $image->setImageColorspace(Imagick::COLORSPACE_SRGB); $image->setImageCompressionQuality(75);