|
Posted by Richard Lynch on 03/02/05 20:29
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
[Back to original message]
|