ImageCreateFromJPEG fails if path contains apostrophe ?



hi there,

i am experiencing a strange problem. i am iterating through a given
directory, selecting only jpg - images that are then resized and
inserted into a database. everything works, but if there is a file
with an apostrophe in it the GD function @ImageCreateFromJPEG fails.
anyone knows this problem and possible workarounds?

thank you,
tim

here is the code

[list.php]
....
while ( $file = readdir($dirhandle) )
{
echo "
....
<a href="show_image.php?path='.rawurlencode($dir.'/'.$file).'">show</
a><br />
....
";
}
....

[show_image.php]
....
if ( $image = LoadJpeg(rawurldecode($_GET["path"])))
{
header("content-type:image/jpeg");
imagejpeg($image);
}
....

with function LoadJpeg defined as:

//taken from http://www.hpserver.de/php/function.imagecreatefromjpeg.html
function LoadJpeg ($imgname) {
$im = @ImageCreateFromJPEG ($imgname); /* Versuch, Datei zu öffnen
*/
if (!$im) { /* Prüfen, ob fehlgeschlagen
*/
$im = ImageCreate (150, 30); /* Erzeugen eines leeren
Bildes */
$bgc = ImageColorAllocate ($im, 255, 255, 255);
$tc = ImageColorAllocate ($im, 0, 0, 0);
ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
/* Ausgabe einer Fehlermeldung */
ImageString($im, 1, 5, 5, "Fehler beim Öffnen von: $imgname",
$tc);
}
return $im;
}

.



Relevant Pages

  • Row cannot be located for updating
    ... I have a very strange problem. ... The table have a primary key based on an Autoincrement field. ... so to read again the database. ... This doesn't happen if CursorLocation is set to clUseServer and CursorType ...
    (borland.public.delphi.database.ado)
  • Re: How to set Date format in UTL_SMTP
    ... | I have one strange problem with UTL_SMTP. ... | machine where the Oracle Database is running. ... Changing the "header" details to: ... to use the user specified data. ...
    (comp.databases.oracle.misc)
  • Re: IE always refreshes images
    ... I have a strange problem with IE presenting my website. ... Every time I reload a page or load a page containing images ... already stored in the cache folder the images are also ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Word 2007 wont display images
    ... and have a strange problem with Word 2007. ... PDF, ... in Word 2007 images that I paste into the document will not display ... will not diplay anything what so ever when I am working in Docx format. ...
    (microsoft.public.word.docmanagement)
  • Pasted images are missing in Docx
    ... and have a strange problem with Word 2007. ... PDF, ... in Word 2007 images that I paste into the document will not display ... will not diplay anything what so ever when I am working in Docx format. ...
    (microsoft.public.word.pagelayout)