I have some code in which I am taking a string and putting it over top of an image. This is running on a Linux server (DreamHost, if that matters).
I am doing this with GD, something like:
$img->string(gdSmallFont, 10, 12, $long_string, $white);
My issue is that $long_string might be longer than the width of the image. I actually check this and then insert a newline in a spot I deem appropriate and then put that into the image - except that the newline (\n - and I even tried \n\r and \r\n and even \r\n\r) is not showing up in the image (they are in the string, but the image continues to plow them through the edge of the frame and it has no line breaks).
Is there a special character that I need to use for GD to respond to the line breaks?
Or perhaps I missed something in the string output where you could define more than just its left corner position, text, and color?
(meaning, definite a smaller rectangle that it should be put into that would fit in the image?)
(on a side note, when I try and load an external TT font, GD fails with an out of memory error - not sure why, hence why the above is just using the default gd system font)
-------------------------------------------------------------------
There are some odd things afoot now, in the Villa Straylight.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.