0

Hi all,
I have a script to built thumbnails for some images.
It's working great, but when the file name for the original picture contains a single quote, it skips that picture.
I use this:
imagejpeg($result, "thumb/".$title.".jpg", 100) or die("Cant save image");

$title is the picture name, received direct from a database.

So a picture named "Dani PHP.jpg" will go fine, but a picture named "Dani's PHP.jpg" will not.

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by kishan112
0

Well, if the imagejpeg() function is chocking on the apostrophe, all you need to do is remove the offending character from $title:

imagejpeg($result, "thumb/" . str_replace("'","",$title) . ".jpg", 100) or die("Cant save image");
0

But I want to have the single quote in the picture name.. I don't want to remove it... Is it possible?

0

try the following, if it still doesn't work, then the problem is the imagejpeg() function in which case you'll have not choice but to remove it.

imagejpeg($result, "thumb/" . stripslashes($title) . ".jpg", 100) or die("Can't save image");
0

I already tried stripslashes().. Maybe I should remove the single quotes :(
Thanks for helping guys!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.