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 #182418 is a reply to message #182417] Sun, 04 August 2013 01:52 Go to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 03/08/13 23:56, Ed Jay wrote:
> Ed Jay 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?
> Thanks for all the replies.
>
> WRT all the suggested strings for cr/lf, none of them seem to play in this
> application. For example, using $br = "\r\n" or $br = chr(10).chr(13),
> etc., appended as:
>
> $msg = 'string1:' . $string1.$br. ' string2: ' . $string2;
>
> yields only strange characters after string1, then, on the same line
> prints string2.
>
> Lew Pitcher's first suggestion works -- make two calls to
> imagestring(), with two individual strings..

yep. NBasically build your own function that does the formatting.

I had to do that for GD and for PDFlite to flow text into PDF documents.

imagestring is [a] primitive...:LOL

> Thanks all.
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[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 Nov 22 03:49:28 GMT 2024

Total time taken to generate the page: 0.03699 seconds