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 |
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.
i have the same Problem with Version 3.4.3 of imagemagic !
My Horde Version is 6.22.2 too.
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);
State ⇒ Not A Bug
[root@dmz-sv-webmail ~]# rpm -q ImageMagick
ImageMagick-6.7.8.9-15.el7_2.x86_64
[root@dmz-sv-webmail ~]#
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
check which version Horde is actually using. As an administrator run
from the horde/admin/phpshell.php the following:
echo phpversion("imagick");
[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 ~]#
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.
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...
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.
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
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ Error when communicating with the server with PDF Attachements
Type ⇒ Bug
Priority ⇒ 3. High
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