Fontstyle not working
Posted: 2008-10-21T02:20:20-07:00
base from the manual
ImagickDraw::setFontStyle — Sets the font style to use when annotating with text
however things not working
when i remove the FONT (FONT/arial.ttf) the fontstyle is working
any ideas ?
thanks for any input
ImagickDraw::setFontStyle — Sets the font style to use when annotating with text
however things not working
Code: Select all
<?php
/* Define width and height of the thumbnail */
$width = 100;
$height = 100;
/* Instanciate and read the image in */
$im = new Imagick( "walalang/Sunset.jpg" );
/* Fit the image into $width x $height box
The third parameter fits the image into a "bounding box" */
$im->thumbnailImage( null, 75 );
/* Create a canvas with the desired color */
$canvas = new Imagick();
$canvas->newImage( $width, $height, new ImagickPixel('#CCCCCC'));
$canvas->setImageFormat('jpeg');
/* Get the image geometry */
$geometry = $im->getImageGeometry();
/* The overlay x and y coordinates */
$x = ( $width - $geometry['width'] ) / 2;
$y = ( $height - $geometry['height'] ) / 2;
/* Composite on the canvas */
$draw = new ImagickDraw();
$draw->setFontStyle( Imagick:: STYLE_ITALIC );
$draw->setFont( "Fonts/arial.ttf" );
$draw->setFontSize( 12 );
$draw->setFillColor( new ImagickPixel("#000000") ); // FONT COLOR
$draw->setGravity( Imagick:: GRAVITY_CENTER );
$im->annotateImage( $draw, 0, 0, 0, "hello worlds" );
$canvas->compositeImage( $im, imagick::COMPOSITE_OVER, $x, $y );
$canvas->drawImage($draw);
/* Output the image*/
header( "Content-Type: image/jpeg" );
echo $canvas;
?>
any ideas ?
thanks for any input