How can I wrap text in an Image using magickwand?

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
vinodkalpaka

How can I wrap text in an Image using magickwand?

Post by vinodkalpaka »

Hi,

I am using a textarea for inputing text and need to embed the text to an image. Here is my code in a simlified form.

$magick_wand=NewMagickWand();
MagickReadImage($magick_wand,'customland.png');


$drawing_wand=NewDrawingWand();
DrawSetFont($drawing_wand,"Fonts/arial.ttf");
DrawSetFontSize($drawing_wand,100);
DrawSetGravity($drawing_wand,MW_CenterGravity);
$pixel_wand=NewPixelWand();
PixelSetColor($pixel_wand,"red");
DrawSetFillColor($drawing_wand,$pixel_wand);

if (MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Red Roses") != 0)
{

MagickEchoImageBlob( $magick_wand );
}
else
{
echo MagickGetExceptionString($magick_wand);
}
.


In this case "Red Roses" is my text and it is working fine. But when I am working with long text, it will coming out of the image. I need to wrap up the text enterd. Is there any way to wrap the text? Please help me.
Thanking in advance.

From,
Vinod
Post Reply