php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54940 Corrupt JPEG data: 200 extraneous bytes before marker 0xc4
Submitted: 2011-05-27 14:10 UTC Modified: 2012-08-12 08:35 UTC
From: php at maisqi dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.3.6 OS: Windows XP 32
Private report: No CVE-ID: None
 [2011-05-27 14:10 UTC] php at maisqi dot com
Description:
------------
I noticed that imagecreatefromjpeg() failed loading some JPEGs. I thought the files were corrupt, but then I successfully opened them on The Gimp.
I noticed that if I opened one of those files on The Gimp and just saved it (without doing any modifications), imagecreatefromjpeg() would open the saved file with no problems.

So, It's clear that some JPEGs are a little different from the others and that The Gimp fixes them on saving.

imagecreatefromjpeg() issues the following warnings:

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 200 extraneous bytes before marker 0xc4 in exp.php on line 3

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '954.jpg' is not a valid JPEG file in exp.php on line 3



PS: I've found bug 39918 similar to this. The problems seam to be related but not the same. The first warnings looks like issued by a lower level function and states that the error is recoverable.

Test script:
---------------
<?php
$fn = '954.jpg';
imagecreatefromjpeg ($fn);


Expected result:
----------------
No warnings.

Actual result:
--------------
It complains.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-27 14:13 UTC] php at maisqi dot com
Here's the JPEG: http://www.maisqi.com/954.jpg
 [2011-08-07 18:13 UTC] php at maisqi dot com
Hello? Anyone?
 [2012-08-03 11:20 UTC] php at maisqi dot com
As with bug 39918, this can be solved with:
   ini_set ('gd.jpeg_ignore_warning', 1);
Please close this entry. Sorry for the bogus.
 [2012-08-12 08:35 UTC] pajoye@php.net
-Status: Open +Status: Not a bug
 [2012-08-12 08:35 UTC] pajoye@php.net
.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 19:01:30 2024 UTC