I could understand the lines 1,2 and 3. But not the remaining. Could you please explain the use of the variable font (font--) and the remaining code. It will be very helpful.
Main Topics
Browse All TopicsHi,
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_wa
$drawing_wand=NewDrawingWa
DrawSetFont($drawing_wand,
DrawSetFontSize($drawing_w
DrawSetGravity($drawing_wa
$pixel_wand=NewPixelWand()
PixelSetColor($pixel_wand,
DrawSetFillColor($drawing_
if (MagickAnnotateImage($magi
{
MagickEchoImageBlob( $magick_wand );
}
else
{
echo MagickGetExceptionString($
}.
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.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
In my case font size should not be changed. But the tail end of the sentence can be trimmed. No need to show all the sentence. (The program will show error for long text that will not fit in textarea).
I will give more information about the problem.
Here are the main user inputs in the first page:
1) text throuh textarea
2) font size - combobox
3) Font face - combobox
In the second page the program should embed the text in a limited box of a blank image png/jpg. That means if give x, y co-ordinates and width of the limted box, the text should embed within that area. There is no problem with trimming of the text in the end. Is there any way for this in magickwand?
I have found one function named 'DrawSetViewbox'. What is the use of that function?
You might need to use DrawSetClipPath, DrawSetClipRule or DrawSetClipUnits to set a clipping region in your image.
If that does not work, then I suggest one option you can do.
1. Determine the maximum length of text that the image can accommodate using MagickGetCharWidth or MagickGetStringWidth. Set this as MAX_LENGTH_ALLOWED. This is also equal to the width of the base image - (some allowance pixels)
2. Before drawing the text, check if the length is > MAX_LENGTH_ALLOWED. If it is, chop one char from the end of the text and check it again if it is > MAX_LENGTH_ALLOWED.
3. Draw the text.
Hope this helps
hec",)
Business Accounts
Answer for Membership
by: harris_cPosted on 2007-08-21 at 15:34:04ID: 19742258
You will need to set this to dynamic ---> DrawSetFontSize($drawing_w and,100);
Something like
1. get width of image.
2. get width of text.
3. while (2) > (1):
font --;
hec",)