Code: Select all
<?php
// get current path
$path = dirname(__FILE__);
// die if font permissions are bad
if(!is_readable("{$path}/sample/FreeMono.ttf")) {
die('Font is not readable!');
}
if(extension_loaded('imagick')) {
$resource = new Imagick();
$status = $resource->readImage("{$path}/sample/scale.gif");
$draw = new ImagickDraw();
$status = $draw->setFont("{$path}/sample/FreeMono.ttf");
if($status !== TRUE) die('DrawSetFont failed!');
$status = $draw->setFontSize(20.0);
if($status !== TRUE) die('DrawSetFontSize failed!');
$status = $resource->annotateImage($draw, 0, 50, 0, 'The quick fox jumps over the lazy dog.');
header('Content-Type: image/gif');
echo $resource;
exit;
}
if(extension_loaded('magickwand')) {
$resource = NewMagickWand();
$status = MagickReadImage($resource, "{$path}/sample/scale.gif");
$draw = NewDrawingWand();
$status = DrawSetFont($draw, "{$path}/sample/FreeMono.ttf");
if($status !== TRUE) die('DrawSetFont failed!');
DrawSetFontSize($draw, 20.0);
$status = MagickAnnotateImage($resource, $draw, 0, 50, 0, 'The quick fox jumps over the lazy dog.');
header('Content-Type: image/gif');
echo MagickEchoImageBlob($resource);
exit;
}
die('No IM extension loaded');
I had to compile ImageMagick from source, and had to disable OpenMP, could this have something to do with it? If not, what could be the problem?