Multiline text line breaks problem help please thank you

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Multiline text line breaks problem help please thank you

Post 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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Multiline text line breaks problem help please thank you

Post 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
:)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Multiline text line breaks problem help please thank you

Post by Bonzo »

Its good you have sorted the problem and its not something I would have thought of.
Post Reply