title: the dreaded "Warning: imagecreatefromjpeg() : '/tmp/filename' is not a valid JPEG file in /phpfile.php on line xxx"
body: <p>I've been getting this warning when some people upload images to our site :</p>
  
  <blockquote>
    <p>Warning: imagecreatefromjpeg()
    [function.imagecreatefromjpeg]:
    gd-jpeg: JPEG library reports
    unrecoverable error: in
    /home/pathremoved/includes/snapsutils.php
    on line 220</p>
    
    <p>Warning: imagecreatefromjpeg()
    [function.imagecreatefromjpeg]:
    '/tmp/phpiw4MFk' is not a valid JPEG
    file in /home/pathremoved.php on line
    220</p>
    
    <p>Warning: imagesx(): supplied argument
    is not a valid Image resource in
    /home/pathremoved.php on line 222</p>
    
    <p>Warning: imagesy(): supplied argument
    is not a valid Image resource in
    /home/pathremoved.php on line 223</p>
    
    <p>Warning: imagecreatetruecolor()
    [function.imagecreatetruecolor]:
    Invalid image dimensions in
    /home/pathremoved.php on line 240</p>
    
    <p>Warning: imagecopyresampled():
    supplied argument is not a valid Image
    resource in /home/pathremoved.php on
    line 242</p>
  </blockquote>
  
  <p>This only happens with certain images, which when opened in any program are ok, it even uploads to the version of the site I have on localhost with no problems...I googled a bit but found nothing conclusive...</p>
  
  <p>note php upload_max size is 5M and post_max_size is 5M. This is not an upload or memory issue. I've tested with 4M images without problems.</p>
  
  <p>any help appreciated.</p>