Basic Example MagickAnnotateImage Problem

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply

Basic Example MagickAnnotateImage Problem

Post by gildir » 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):

Code: Select all

	if (!file_exists(FONT_PATH.$_POST[font].'.ttf') || !is_readable(FONT_PATH.$_POST[font].'.ttf'))
		echo "Font File Error (".FONT_PATH.$_POST[font].'.ttf'.")";
	$result = MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Banana");
	if(!$result || $result == 0)
		echo 'Error: '.MagickGetExceptionString($magick_wand);
	header( 'Content-Type: image/gif' );
	MagickEchoImageBlob( $magick_wand );
Any help would be appreciated.

User avatar
Site Admin
Posts: 11078
Joined: 2003-05-31T11:32:55-07:00

Re: Basic Example MagickAnnotateImage Problem

Post by magick » 2009-02-26T09:03:00-07:00

Unfortunately we cannot reproduce the problem. We took your code and hard-coded paths for a file of rose.jpg and font of arial.ttf and issued these commands:
  • convert rose: rose.jpg
    php wand.php > banana.jpg
The resulting banana.jpg is a rose with Banana written across the center in black. We're using ImageMagick 6.4.9-7 and MagickWand for PHP 1.0.8.


Re: Basic Example MagickAnnotateImage Problem

Post by gildir » 2009-02-28T18:06:18-07:00

Thank you, that was very helpful in tracking down my error (GhostScript wasn't configured correctly).

Post Reply