#25581 [Opn->Bgs]: getimagesize () return incorrect values on bitmap (os2) files
| From: | sniper@php.net | Date: | Wed, 17 Sep 2003 22:21:36 +0000 |
| Subject: | #25581 [Opn->Bgs]: getimagesize () return incorrect values on bitmap (os2) files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-47721@lists.php.net to get a copy of this message | ||
ID: 25581
Updated by: sniper@php.net
Reported By: willertan1980 at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: GetImageSize related
Operating System: WinXP sp1
PHP Version: 4.3.1
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
We're at 4.3.3 now in which many MANY bugs have been fixed..
Previous Comments:
------------------------------------------------------------------------
[2003-09-17 16:38:14] willertan1980 at yahoo dot com
Description:
------------
getimagesize () return incorrect values on bitmap files
SYSTEM PHP 4.3.1(bundled version gd >1.6) , WinXP IIS 5.1 server, Intel
P4 CPU
TESTED image : RGB 24bits OS/2 bitmap (BM) generated by Photoshop 7.0
>>HEX DUMP image data 1st 32bytes - bitmaps header 12 bytes
4d 2c d0 01 00 00 00 00 00 1a 00 00
00 0c 00
00 f0 00 a5 00 01 00 18 00 b0 7f 6d
a9 75 62
i realized that getimagesize () read OS/2 1.x bitmap by using Windows
3.x / OS/2 2.x structure, that is the reason the output was incorrect.
>>DUMP form getimagesize () :
Array ( [0] => 10813680 [1] => 1572865 [2] => 6 [3] => width="10813680"
height="1572865" [bits] => 43373 [mime] => image/bmp )
>>DUMP from my own function, bmp_info () (identical to values that
given by WinXP properties and photoshop 7)
Array ( [width] => 240 [height] => 165 [planes] => 1 [bits] => 24
[bi_type] => Bitmap [bi_hsz] => 12 [bi_htype] => OS/2 1.x [ncolor] =>
16777216 [xdensity] => 96 [ydensity] => 96 [density_mod] => 1
[component] => 3 [compression] => 0 )
>>Header for bmp >= Windows 2.x and OS/2 1.x
typedef struct _WinBMPFileHeader, 14 bytes
{
WORD FileType;
DWORD FileSize;
WORD Reserved1;
WORD Reserved2;
DWORD BitmapOffset;
} WINBMPFILEHEADER;
Bitmap Windows 3.x should use this format, always 40 bytes
typedef struct tagBITMAPINFOHEADER{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER;
but Bitmap Windows 2.x and OS/2 1.x should read like this, and its
always 12 bytes
typedef struct _Win2xBitmapHeader
{
DWORD Size;
SHORT Width;
SHORT Height;
WORD Planes;
WORD BitsPerPixel;
} WIN2XBITMAPHEADER;
REFERENCE
http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm
http://netghost.narod.ru/gff/graphics/summary/micbmp.htm
Windows BITMAPINFO-
http://msdn.microsoft.com/library/en-us/gdi/bitmaps_0zn6.asp?frame=true
Windows BITMAPINFOHEADER-
http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp?frame=true
http://www.fastgraph.com/help/bmp_header_format.html
*please remove this message if outdated or solved
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25581&edit=1