Basic Example MagickAnnotateImage Problem
Posted: 2009-02-26T03:37:38-07:00
I'm trying out the basic MagickWand example, but I'm having a problem. MagickAnnotateImage is returning false, but MagickGetExceptionString doesn't return an error. I've checked the font path, the image path, etc. but they're all correct. If I don't kill on error, MagickEchoImageBlob does produce the original image I read, but without the text I want annotated.
Here's my test code (it produces "Error: " for me):
Any help would be appreciated.
Here's my test code (it produces "Error: " for me):
Code: Select all
$magick_wand=NewMagickWand();
MagickReadImage($magick_wand,$_POST[image_loc]);
$drawing_wand=NewDrawingWand();
if (!file_exists(FONT_PATH.$_POST[font].'.ttf') || !is_readable(FONT_PATH.$_POST[font].'.ttf'))
{
echo "Font File Error (".FONT_PATH.$_POST[font].'.ttf'.")";
die();
}
DrawSetFont($drawing_wand,FONT_PATH.$_POST[font].'.ttf');
DrawSetFontSize($drawing_wand,20);
DrawSetGravity($drawing_wand,MW_CenterGravity);
$pixel_wand=NewPixelWand();
PixelSetColor($pixel_wand,"black");
DrawSetFillColor($drawing_wand,$pixel_wand);
$result = MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Banana");
if(!$result || $result == 0)
{
echo 'Error: '.MagickGetExceptionString($magick_wand);
die();
}
header( 'Content-Type: image/gif' );
MagickEchoImageBlob( $magick_wand );