6.0.0-beta1
7/3/25

[#14833] Error when communicating with the server with PDF Attachements
Summary Error when communicating with the server with PDF Attachements
Queue IMP
Queue Version 6.2.22
Type Bug
State Not A Bug
Priority 1. Low
Owners
Requester Klaus.Steinberger (at) physik (dot) uni-muenchen (dot) de
Created 07/10/2018 (2550 days ago)
Due
Updated 11/05/2018 (2432 days ago)
Assigned
Resolved 07/29/2018 (2531 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
11/05/2018 09:39:32 PM build+horde (at) de-korte (dot) org Comment #11 Reply to this comment
And your version of ImageMagick is? Note that *reading* PDF files has 
been switched off for ImageMagick in many distributions lately, to 
deal with security issues with the underlying Ghostscript library.

Currently, it is adviseable to switch of generating thumbnails for PDF 
files by adding

     $mime_drivers['pdf']['thumbnails'] = false;

to your 'imp/config/mime_drivers.local.php' file.
11/05/2018 08:18:42 PM dl2ocb (at) dl2ocb (dot) de Comment #10 Reply to this comment

[Show Quoted Text - 12 lines]
Hello,
i have the same Problem with Version 3.4.3 of imagemagic !

My Horde Version is 6.22.2 too.

08/06/2018 03:44:09 PM horde-support (at) ionknight (dot) com Comment #9 Reply to this comment
Just experienced the same problem on an up to date install of CentOS 7 
that uses upstream released packages.

I would suggest that a more elegant solution would be....

--- Pdf-released.php    2018-07-05 01:31:00.000000000 -0500
+++ Pdf-patched.php     2018-08-06 10:32:10.828102717 -0500
@@ -139,10 +139,18 @@
              if ($img instanceof Horde_Image_Imagick) {
                  /* Get rid of PDF transparency. */
                  $img->imagick->setImageBackgroundColor('white');
-                 
$img->imagick->setImageAlphaChannel(imagick::ALPHACHANNEL_REMOVE);
-                return 
$GLOBALS['injector']->getInstance('Horde_Core_Factory_Image')->create(array(
-                    'data' => 
$img->imagick->mergeImageLayers(imagick::LAYERMETHOD_FLATTEN)->getImageBlob()
-                ));
+                if (version_compare ( phpversion( 'imagick' ), 
'3.3.0', '<' ) ) {
+                       # Maintain compatibility with packaged OSes
+                       return 
$GLOBALS['injector']->getInstance('Horde_Core_Factory_Image')->create(array(
+                               'data' => 
$img->imagick->flattenImages()->getImageBlob()
+                       ));
+                } else {
+                       # Support Newer iMagick installations
+                       
$img->imagick->setImageAlphaChannel(imagick::ALPHACHANNEL_REMOVE);
+                       return 
$GLOBALS['injector']->getInstance('Horde_Core_Factory_Image')->create(array(
+                               'data' => 
$img->imagick->mergeImageLayers(imagick::LAYERMETHOD_FLATTEN)->getImageBlob()
+                       ));
+               }
              }

              return $img->getImageAtIndex(0);

[Show Quoted Text - 15 lines]
07/29/2018 03:04:38 PM Michael Rubinsky Priority ⇒ 1. Low
State ⇒ Not A Bug
 
07/13/2018 05:18:32 AM Klaus (dot) Steinberger (at) physik (dot) uni-muenchen (dot) de Comment #8 Reply to this comment
is it possible, that the ImageMagick version is too old on Centos 7.5 ?

[root@dmz-sv-webmail ~]# rpm -q ImageMagick
ImageMagick-6.7.8.9-15.el7_2.x86_64
[root@dmz-sv-webmail ~]#
Yep! This was it.  I installed now 
ImageMagick6-6.9.10.6-1.el7.remi.x86_64 from remi's Repo and rebuilt 
the imagick pecl extension, and voila! now it works.


So problem is solved now for me

07/13/2018 04:46:38 AM Klaus (dot) Steinberger (at) physik (dot) uni-muenchen (dot) de Comment #7 Reply to this comment
In retrospect, this was less clear than I intended. You need to 
check which version Horde is actually using. As an administrator run 
from the horde/admin/phpshell.php the following:

echo phpversion("imagick");
it says 3.4.3 !

[root@dmz-sv-webmail ~]# strings 
/opt/rh/php55/root/usr/lib64/php/modules/imagick.so | grep ALPHA
COLOR_ALPHA
CHANNEL_ALPHA
CHANNEL_TRUEALPHA
ALPHACHANNEL_ACTIVATE
ALPHACHANNEL_RESET
ALPHACHANNEL_SET
ALPHACHANNEL_UNDEFINED
ALPHACHANNEL_COPY
ALPHACHANNEL_DEACTIVATE
ALPHACHANNEL_EXTRACT
ALPHACHANNEL_OPAQUE
ALPHACHANNEL_SHAPE
ALPHACHANNEL_TRANSPARENT
ALPHACHANNEL_BACKGROUND
ALPHACHANNELTYPE
PHP_IMAGICK_COLOR_ALPHA
[root@dmz-sv-webmail ~]#

is it possible, that the ImageMagick version is too old on Centos 7.5 ?

[root@dmz-sv-webmail ~]# rpm -q ImageMagick
ImageMagick-6.7.8.9-15.el7_2.x86_64
[root@dmz-sv-webmail ~]#




07/11/2018 01:48:49 PM build+horde (at) de-korte (dot) org Comment #6 Reply to this comment
Your version of imagick is indeed too old.  The reason for the changes 
is that Imagick::flattenImages() which was used previously in the 
generation of the PDF thumbnails was removed in 3.3.0:

https://pecl.php.net/package-info.php?package=imagick&version=3.3.0

The replacement  for this is

$im->setImageBackgroundColor('white');
$im->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE);
$im->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);

so this pulls in the requirement for this constant, which was added in 
3.2.0b2:

https://pecl.php.net/package-info.php?package=imagick&version=3.2.0b2

Note that 3.3.0 was released more than two years ago and 3.2.0b2 has 
been available for almost five years already, released mere weeks 
after 3.1.2 was released.
07/11/2018 01:12:56 PM lst_hoe02 (at) kwsoft (dot) de Comment #5 Reply to this comment
We have on both systems "3.1.2" as version for imagick. This is simply 
the fact that there is no custom install beside Horde Pear modules, so 
imagick come from Ubuntu 14.04 LTS.
So there must be a incompatible change related to imagick in the 
latest IMP package...
07/10/2018 07:44:42 PM build+horde (at) de-korte (dot) org Comment #4 Reply to this comment
In retrospect, this was less clear than I intended. You need to check 
which version Horde is actually using. As an administrator run from 
the horde/admin/phpshell.php the following:

echo phpversion("imagick");

to see which version is used by Horde. Chances are there are newer 
versions installed on your system, but Horde is just looking in a 
different location.

07/10/2018 02:17:18 PM build+horde (at) de-korte (dot) org Comment #3 Reply to this comment
Check the version of imagick you're using. It is probably outdated.
07/10/2018 02:09:41 PM lst_hoe02 (at) kwsoft (dot) de Comment #2 Reply to this comment
The same problem here since the update to latest IMP. Base System is 
Ubuntu 14.04 LTS fully pacthed. Same OS one step behind latest IMP 
release works fine for the same e-mail.

[Tue Jul 10 16:00:59.373134 2018] [:error] [pid 6758] [client 
2a03:3500:111:4::2:45642] PHP Fatal error:  Undefined class constant 
'ALPHACHANNEL_REMOVE' in /var/www/horde/imp/lib/Mime/Viewer/Pdf.php on 
line 142, referer: https://my-hostname/imp/dynamic.php?page=mailbox

07/10/2018 12:45:18 PM Klaus (dot) Steinberger (at) physik (dot) uni-muenchen (dot) de Comment #1
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ Error when communicating with the server with PDF Attachements
Type ⇒ Bug
Priority ⇒ 3. High
Reply to this comment
Since the update to 6.2.22 emails with PDF Attachements will not load, 
with the error: "Error when communicating with the server". In the 
horde log this is logged:

2018-07-10T14:17:28+02:00 EMERG: HORDE [imp] Undefined class constant 
'ALPHACHANNEL_REMOVE' [pid 7681 on line 142 of 
"/var/www/html/horde/imp/lib/Mime/Viewer/Pdf.php"]

This happens both with pecl imagick versions 3.3.0 and 3.4.3 on a 
CentOS 7.5 system


Saved Queries