ImagickDraw::setFont issue with Zend Server CE?

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
catalinag
Posts: 1
Joined: 2011-07-04T09:34:09-07:00
Authentication code: 8675308

ImagickDraw::setFont issue with Zend Server CE?

Post by catalinag »

Hi,
I have been doing some testing of Imagick for use on an upcoming project which is to be developed in PHP 5. So far Imagick has performed very well, but I am experiencing an issue which I do not know how to resolve. All functionality seems to work perfectly except ImagickDraw::setFont. In all tests I have been unable to alter the font used for any annotated text added to my image.

My sample code:

Code: Select all

$im = new Imagick('path-to/image/background.png');
$draw = new ImagickDraw();
$draw->setFont('arial.ttf'); /* .ttf file located in root directory with this script */
$draw->setFontSize(50);
$draw->setFillColor('#ec1010');
$draw->annotation(20, 50, "My test image text");
$im->drawImage($draw);
$im->borderImage( 'black', 1, 1 ); 
header("Content-type: ".$im->getFormat());
echo $im->getimageblob();
I am using PHP Zend Server 5.2 CE installed through yum from the Zend repository, running on a CentOS 5.5 server.
Imagick 6.3.7 has also been installed as one of the extras from the Zend yum repository.
All other features (that I have tested) work perfectly except the ability to alter the font used.

I have seen from other threads on this forum that reported a similar issue which required Imagick to be built from source to include freetype support. Before I re-install my server to try building this from source, can anyone tell me if they have had this working on a Zend repository install, or if there is something else which could be causing this?

Thanks in advance for any help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImagickDraw::setFont issue with Zend Server CE?

Post by fmw42 »

try using the full path from root to your font (in the absence of freetype)

/arial.ttf

or move the font to your user directory and provide the full path similar to how you provide the path to the image.
Post Reply