Weird Error when Uploading an Image: imagecreatefromjpeg()

imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file

Situation:

  • IE
  • Safari, Firefox and Chrome in some Mac

Tips:

  • ini_set("gd.jpeg_ignore_warning", 1);
  • Turn off error reporting
  • Turn off error handler
  • @imagecreatefromjpeg()

Reference:

  • http://www.php.net/manual/en/function.imagecreatefromjpeg.php
  • http://worcesterwideweb.com/2008/03/17/php-5-and-imagecreatefromjpeg-recoverable-error-premature-end-of-jpeg-file/
  • http://forums.devshed.com/php-development-5/mms-jpeg-format-imagecreatefromjpeg-186799.html