php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26688 getimagesize doesn't return correct width and height for bmp files
Submitted: 2003-12-22 06:33 UTC Modified: 2004-04-21 20:55 UTC
From: paul at i3 dot co dot uk Assigned:
Status: Closed Package: GetImageSize related
PHP Version: 4.3.4 OS: slackware
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
32 - 32 = ?
Subscribe to this entry?

 
 [2003-12-22 06:33 UTC] paul at i3 dot co dot uk
Description:
------------
Contrary to 4.3.4 change log

Fixed width/height detection of bmp images using 
getimagesize() function on big endian systems and added 
code to retrieve bmp bit depth. (Ilia)

I still receive incorrect output when querying a local 
.bmp.

Expected result:
----------------
When queried with imagemagick identify verbose returns

Image: example.bmp
  Format: BMP (Microsoft Windows bitmap image)
  Geometry: 800x560
  Class: DirectClass
  Type: true color
  Depth: 8 bits-per-pixel component
  Colors: 56670
  Filesize: 1312kb
  Interlace: None
  Background Color: white
  Border Color: #dfdfdf
  Matte Color: grey74
  Iterations: 0
  Compression: 
  signature: 
6b89fd02035b663968e3a0f127da0c0dc5e940e060446a21c40cb330
f0bbc5ce
  Tainted: False
  User Time: 0.0u
  Elapsed Time: 0:01

Tested with 20 or so similar sized bmp file same problem 
occurs.


Actual result:
--------------
 files output using getimagesize returns

array(5) {
  [0]=>
  int(36700960)
  [1]=>
  int(1572865)
  [2]=>
  int(6)
  [3]=>
  string(33) "width="36700960" height="1572865""
  ["mime"]=>
  string(9) "image/bmp"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-22 10:53 UTC] iliaa@php.net
Please provide the bmp file in question.
 [2003-12-22 11:41 UTC] paul at i3 dot co dot uk
snapshot 4.3.5-dev resolves the problem tested with all 20 
each working correctly thanks Ilia.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri May 14 11:01:23 2021 UTC