php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12354 getImageSize() fails for some JPEGs
Submitted: 2001-07-24 19:57 UTC Modified: 2001-07-25 10:42 UTC
From: matt at earth dot care2 dot com Assigned:
Status: Closed Package: GetImageSize related
PHP Version: 4.0.5 OS: linux
Private report: No CVE-ID: None
 [2001-07-24 19:57 UTC] matt at earth dot care2 dot com
JPEGs saved directly from some digital cameras do not contain whatever data getImageSize relies on to produce an array of size and type data. Opening such an image and re-saving (even as JPEG) within an image editor (photoshop or equivalent) will 'fix' the image, allowing getImageSize() to read it.

Here's an image that causes getImageSize() to fail:
http://sitefoundry.com/php/DSC00021.JPG

Here's the same image after opening/saving; getImageSize() copes fine with this one:
http://sitefoundry.com/php/DSC00021fixed.jpg

Here's the output of ImageMagick's 'identify' utility for both images:
DSC00021fixed.jpg 640x480 DirectClass 81kb JPEG 1s
DSC00021.JPG[1] 640x480 DirectClass 88kb JPEG 2s

Here's the output of 'file':
DSC00021fixed.jpg: JPEG image data, JFIF standard
DSC00021.JPG:      JPEG image data

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-24 20:04 UTC] rasmus@php.net
Are you absolutely sure you are using PHP 4.0.6?  This was a bug in 4.0.5.
 [2001-07-24 20:12 UTC] rasmus@php.net
... and checking the image you posted, it works fine for me with the current getimagesize() in CVS.  And I don't think it has changed since 4.0.6

 [2001-07-25 10:42 UTC] matt at earth dot care2 dot com
My initial report gave the wrong version -- this is indeed fixed in 4.0.6. Sorry for the misdirection; I thought one of my two test systems had already been upgraded.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 10:01:29 2024 UTC