"not a valid JPEG file"



I am trying to upload an image to a server, but I get this warning:

Warning: imagecreatefromjpeg(): 'filename' is not a valid JPEG file

The error occurs when I am trying to create a thumbnail from the image. I
can subsequently display the JPG image itself, but the thumbnail creation
fails. I have tried this with hundreds of other images from the same source
and they work fine.

I have looked around on Google and it seems that others have had this same
problem, but I have not been able to find a solution.

Is this a PHP bug? Is there a workaround? Should I just trap the warning
and tell the user (my users will upload their own images) that the file is
not valid? They will surely question this, because seemingly every other
image displayer has no trouble with it.

--
Stephen Oakes


.



Relevant Pages

  • Re: "not a valid JPEG file"
    ... >I am trying to upload an image to a server, ... > Warning: imagecreatefromjpeg: 'filename' is not a valid JPEG file ... considered corrupt by PHP's imagecreatefromjpeg function. ...
    (comp.lang.php)
  • Re: "not a valid JPEG file"
    ... >> I am trying to upload an image to a server, but I get this warning: ... >> and tell the user (my users will upload their own images) that the file ... > renamed GIF/PNG/whatever the same viewer will be started because of the ... > jpegs. ...
    (comp.lang.php)
  • Re: "not a valid JPEG file"
    ... > I am trying to upload an image to a server, but I get this warning: ... > Warning: imagecreatefromjpeg(): 'filename' is not a valid JPEG file ... > and tell the user (my users will upload their own images) that the file is ... able to discern the real file type from them. ...
    (comp.lang.php)
  • Image storing in database
    ... to upload image data to a database, but all that is uploaded is the ... Warning: fread(): supplied argument is not a valid File-Handle resource ...
    (comp.lang.php)