|
Posted by Aaron Todd on 03/02/05 23:17
BEAUTIFUL!!!!
Thats exactly what I was looking for. I'm not doing anything with MySQL so
I am going to leave Magic Quotes on and just use stripslashes()
Thanks a bunch.
"Richard Lynch" <ceo@l-i-e.com> wrote in message
news:2959.66.99.91.45.1109788187.squirrel@www.l-i-e.com...
> Aaron Todd wrote:
>> I've created a simple script that takes in image and draws some lines and
>> some text on top of it. I am having a problem with the text part of
>> this.
>> When the string that I am drawing on the image contains and apostrophe
>> ( '
>> )
>> there is always a backslash ( \ ) before it. It make sense that it is
>> the
>> escape character, but I need to be able to show the apostrophe. Anyone
>> have
>> any ideas about this?
>>
>> <?php
>> $backdir = "/var/www/html/backgrounds/";
>> $im = ImageCreatefromJPEG($backdir.$_GET['background']);
>
> Because you have Magic Quotes GPC on, all GET/POST/COOKIE data
> automatically has addslashes called on it, before you see it.
>
> That's "good" because you are probably usually putting your data into a
> MySQL database that needs that.
>
> In this case, though, you want to use http://php.net/stripslashes to
> "undo" the automated addslashes of Magic Quotes.
>
> Or, if your site mostly/only takes GET data and puts it on images, and
> rarely puts it into the database, go ahead and turn Magic Quotes GPC "off"
> in php.ini (or in your .htaccess)
>
> Note that you can't turn it off in your script with ini_set since the GPC
> data is already altered by the time your script starts.
>
> GD is not really directly involved, per se, in this issue. You'd have the
> same problem if you were putting your GET data into a file, or displaying
> it directly to the user, or pretty much doing anything at all with it
> *except* for stuffing it into MySQL.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|