I' ve noticed some strange issue. I' ve taken the button+text code from http://valokuva.org/
Code: Select all
<?php
/* Create a new Imagick object */
$im = new Imagick();
/* Create empty canvas */
$im->newImage( 200, 200, "white", "png" );
/* Create the object used to draw */
$draw = new ImagickDraw();
/* Set the button color.
* Changing this value changes the color of the button */
$draw->setFillColor( "#4096EE" );
/* Create the outer circle */
$draw->circle( 50, 50, 70, 70 );
/* Create the smaller circle on the button */
$draw->setFillColor( "white" );
/* Semi-opaque fill */
$draw->setFillAlpha( 0.2 );
/* Draw the circle */
$draw->circle( 50, 50, 68, 68 );
/* Set the font */
$draw->setFont( "./test1.ttf" );
/* This is the alpha value used to annotate */
$draw->setFillAlpha( 0.17 );
/* Draw a curve on the button with 17% opaque fill */
$draw->bezier( array(
array( "x" => 10 , "y" => 25 ),
array( "x" => 39, "y" => 49 ),
array( "x" => 60, "y" => 55 ),
array( "x" => 75, "y" => 70 ),
array( "x" => 100, "y" => 70 ),
array( "x" => 100, "y" => 10 ),
) );
/* Render all pending operations on the image */
$im->drawImage( $draw );
/* Set fill to fully opaque */
$draw->setFillAlpha( 1 );
/* Set the font size to 30 */
$draw->setFontSize( 30 );
/* The text on the */
$draw->setFillColor( "white" );
/* Annotate the text */
$im->annotateImage( $draw, 38, 55, 0, "go" );
/* Trim extra area out of the image */
$im->trimImage( 0 );
/* Output the image */
header( "Content-Type: image/png" );
echo $im;
?>
Everything is ok when I remove the following parts of code:
Code: Select all
(…)
/* Set the font */
$draw->setFont( "./test1.ttf" );
(…)
/* Set the font size to 30 */
$draw->setFontSize( 30 );
(…)
/* Annotate the text */
$im->annotateImage( $draw, 38, 55, 0, "go" );
Any ideas what is the reason, and how to fix this?