Page 1 of 1

Multiline text line breaks problem help please thank you

Posted: 2010-11-27T01:52:09-07:00
by javismiles
hi everybody :)
I am using imagemagick since a few weeks ago and i really love it, congrats to all the development team.
I am developing an app with javascript, ajax, php and imagemagick and i have this strange problem.

In my local computer, i use successfully the following command to create a png image with a multiline text inside:
example, something like this

$command =' convert -background none -fill #546543 -font arial -pointsize 71 label:"this is multiline text\nanother line \n another line" result.png ';

this works well in my local computer that uses Apache server. I Am using \n as the break lines.
The text comes from an html Text Area field. To make this work in javascript i had to add this :
text= text.replace(/\n\r?/g, '\\n');

so it works great.

The problem comes when i move this to the production server which has II6 windows server instead of Apache.
When i do that, this doesnt work anymore. Single lines work but multilines dont,
any of you had similar problems between using apache and then a windows server?

could you maybe advice me what is the safest and most efficient way to pass multiline text from a text area field in html , through javascript,
to php and ultimately to imagemagick?
the route in my code is

1) user enters multiline text on an input text area field in html
2) text arrives to a javascript function
3) the javascript function inserts the text inside an AJAX call that goes to a PHP file
4) the PHP file calls imagemagick

what would be the best way to do that to ensure the line breaks \n stay all the way correctly formatted from the
input text area through javascript, php and till imagemagick? so that it hopefully will work in both apache and windows?

thank you so very much for your help, im very happy i found this forum

best
Jav

Re: Multiline text line breaks problem help please thank you

Posted: 2010-11-27T23:49:53-07:00
by javismiles
i found the problem, it was the magic_quotes in the windows server set to on, whereas
on my local computer it was off :) its solved now
best
jav
:)

Re: Multiline text line breaks problem help please thank you

Posted: 2010-11-28T06:33:01-07:00
by Bonzo
Its good you have sorted the problem and its not something I would have thought of.