Package graphicsmagick compiled without FreeType support
Seems like graphicsmagick
is build without FreeType support:
docker run --rm -it alpine:3.4 sh
/ # apk add --update --repository http://dl-cdn.alpinelinux.org/alpine/edge/community graphicsmagick
(1/10) Installing libgcc (5.3.0-r0)
(2/10) Installing libgomp (5.3.0-r0)
(3/10) Installing libjpeg-turbo (1.4.2-r0)
(4/10) Installing libjasper (1.900.1-r12)
(5/10) Installing libltdl (2.4.6-r0)
(6/10) Installing libpng (1.6.21-r0)
(7/10) Installing libstdc++ (5.3.0-r0)
(8/10) Installing tiff (4.0.6-r3)
(9/10) Installing libxml2 (2.9.4-r0)
(10/10) Installing graphicsmagick (1.3.25-r0)
OK: 14 MiB in 21 packages
/ # gm version
GraphicsMagick 1.3.25 2016-09-05 Q16 http://www.GraphicsMagick.org/
Copyright (C) 2002-2016 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
...
FreeType no
...
When it’s used with PHP 7 to generate an image with text it triggers an
error:
FreeType library is not available (/usr/share/fonts/Type1/n019003l.pfb)
How to reproduce:
docker run --rm -it alpine:3.4 sh
/ # apk add --update --repository http://dl-cdn.alpinelinux.org/alpine/edge/community --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing php7 php7-gmagick freetype graphicsmagick ghostscript ghostscript-fonts
(1/30) Installing libpng (1.6.21-r0)
(2/30) Installing freetype (2.6.3-r0)
(3/30) Installing dbus-libs (1.10.8-r1)
(4/30) Installing libintl (0.19.7-r3)
(5/30) Installing avahi-libs (0.6.32-r0)
(6/30) Installing libgcc (5.3.0-r0)
(7/30) Installing gmp (6.1.0-r0)
(8/30) Installing nettle (3.2-r0)
(9/30) Installing libffi (3.2.1-r2)
(10/30) Installing libtasn1 (4.8-r0)
(11/30) Installing p11-kit (0.23.2-r0)
(12/30) Installing gnutls (3.4.15-r0)
(13/30) Installing libstdc++ (5.3.0-r0)
(14/30) Installing cups-libs (2.1.3-r1)
(15/30) Installing expat (2.1.1-r1)
(16/30) Installing fontconfig (2.12.1-r0)
(17/30) Installing jbig2dec (0.12-r0)
(18/30) Installing libjpeg-turbo (1.4.2-r0)
(19/30) Installing lcms2 (2.7-r0)
(20/30) Installing tiff (4.0.6-r3)
(21/30) Installing ghostscript (9.19-r1)
(22/30) Installing ghostscript-fonts (8.11-r1)
(23/30) Installing libgomp (5.3.0-r0)
(24/30) Installing libjasper (1.900.1-r12)
(25/30) Installing libltdl (2.4.6-r0)
(26/30) Installing libxml2 (2.9.4-r0)
(27/30) Installing graphicsmagick (1.3.25-r0)
(28/30) Installing php7-common (7.0.11-r1)
(29/30) Installing php7 (7.0.11-r1)
(30/30) Installing php7-gmagick (2.0.4_rc1-r1)
OK: 77 MiB in 41 packages
# fix php7-gmagick extension problem https://bugs.alpinelinux.org/issues/6355
/ # mv /etc/php7/conf.d/10_.ini /etc/php7/conf.d/10_gmagick.ini && echo "extension=gmagick.so" > /etc/php7/conf.d/10_gmagick.ini
/ # cat <<EOF > /tmp/test.php
<?php
\$image = new Gmagick();
\$image->newImage(300, 300, '#cccccc', 'png');
\$draw = new GmagickDraw();
\$draw->setFillColor('#969696');
\$draw->setFontSize(48);
\$draw->annotate(150, 100, 'hello');
\$image->drawImage(\$draw);
\$image->writeImage('/tmp/test.png');
EOF
/ # cat /tmp/test.php
<?php
$image = new Gmagick();
$image->newImage(300, 300, '#cccccc', 'png');
$draw = new GmagickDraw();
$draw->setFillColor('#969696');
$draw->setFontSize(48);
$draw->annotate(150, 100, 'hello');
$image->drawImage($draw);
$image->writeImage('/tmp/test.png');
/ # php7 /tmp/test.php
PHP Fatal error: Uncaught GmagickException: FreeType library is not available (/usr/share/fonts/Type1/n019003l.pfb) in /tmp/test.php:10
Stack trace:
#0 /tmp/test.php(10): Gmagick->drawimage(Object(GmagickDraw))
#1 {main}
thrown in /tmp/test.php on line 10
/ # ls -alh /usr/share/fonts/Type1/n019003l.pfb
-rw-r--r-- 1 root root 67.0K Apr 29 20:58 /usr/share/fonts/Type1/n019003l.pfb
After removing the line rendering text
($draw->annotate(150, 100, 'hello');
) it works as expected:
/ # php7 /tmp/test.php
/ # ls -alh /tmp/test.png
-rw-r--r-- 1 root root 838 Oct 15 12:20 /tmp/test.png
(from redmine: issue id 6356, created on 2016-10-15, closed on 2019-05-03)
- Changesets:
- Revision 19e3589c on 2017-09-20T08:29:03Z:
community/graphicsmagick: build with FreeType support
fixes #6356