[magick-users] MagickWand text annotations in PHP

Kent Kent at themagicm.com
Sat Nov 10 11:14:15 PST 2007


Not sure about the exception, but from a quick look, I think you 
might be writing the text in the same color as the background, which 
would explain why it wouldn't be visible.  Hope that helps -- Kent


>Hi all,
>
>I'm trying to get a basic script working which uses MagickWand in 
>PHP - it's based on the standard example from the MagickWand documentation:
>
>------------------------------------------------------
>
><?php
>
>$font_file = '100.ttf';
>$photo_file = '880.jpg';
>
>$magick_wand=NewMagickWand();
>MagickReadImage($magick_wand,$photo_file);
>$drawing_wand=NewDrawingWand();
>
>if (!file_exists($font_file) || !is_readable($font_file)) echo "Font 
>file does not exist or is not readable";
>if (!file_exists($photo_file) || !is_readable($photo_file)) echo 
>"Photo file does not exist or is not readable";
>
>DrawSetFont($drawing_wand,$font_file);
>DrawSetFontSize($drawing_wand,20);
>DrawSetGravity($drawing_wand,MW_CenterGravity);
>$pixel_wand=NewPixelWand();
>PixelSetColor($pixel_wand,"white");
>DrawSetFillColor($drawing_wand,$pixel_wand);
>
>if (!IsDrawingWand($drawing_wand)) echo "\$drawing_wand is not a 
>DrawingWand resource";
>
>if (MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Rose") != 0) {
>         MagickEchoImageBlob( $magick_wand );
>} else {
>         echo "Exception: " . MagickGetExceptionString($magick_wand);
>}
>
>?>


   Kent Multer                  |\  /|
   Magic Metal Productions      | \/ |
   http://TheMagicM.com         |    |

  * Web developer/designer
  * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/ISBN=0966103211/magicmetalproducA



More information about the Magick-users mailing list