FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Newline (cr/lf) in imagestring
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Newline (cr/lf) in imagestring [message #182410 is a reply to message #182409] Sat, 03 August 2013 20:31 Go to previous messageGo to previous message
Ed Jay is currently offline  Ed Jay
Messages: 7
Registered: August 2013
Karma:
Junior Member
Lew Pitcher wrote:

> On Saturday 03 August 2013 14:59, in comp.lang.php, edMbj(at)aes-intl(dot)com
> wrote:
>
>> I'm merging text into an image using:
>>
>> $msg = 'string1:' . $string1 . ' string2: ' . $string2;
>>
>> $text = imagecreatetruecolor($width, $height);
>> imagestring($text, 5, 50, 50, $msg, 0x00ff00);
>> imagecopymerge($final, $text, 50, 50, 50, 50, $width, $height, 100);
>>
>> The above works.
>>
>> What I want to do is have ' string2: ' . $string2 show on a new line. How?
>>
>> Anything with the quotes displays as a literal, e.g., '\r\n string2'
>> outputs as \r\n\string2, as does <br> and anything else, just as the
>> manual says it will. I tried adding the string PCP_EOL, but it didn't
>> play. I tried $msg = nl2br(string to output) with \r\n within the string,
>> but it doesn't play.
>>
>> So...how do I produce cr/lf?
>
> The php.net description of the imagestring() function
> (http://php.net/manual/en/function.imagestring.php) says that it draws "a
> string horizontally".
>
> I believe that the function is not constructed to draw multiple lines, but
> only text in a single horizontal line.
>
> So, to draw two strings, one line apart, you make two calls to
> imagestring(), with two individual strings.
>
> The second call should use the first call's x and y values, offset by the
> font size (imagefontheight()) plus the amount of space between each line.

Thanks.

--
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Reading a file on same server
Next Topic: ini_get("memory_limit") returns an empty string
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 17:30:01 GMT 2024

Total time taken to generate the page: 0.04666 seconds