ID: 25581 Updated by: [EMAIL PROTECTED] Reported By: willertan1980 at yahoo dot com -Status: Bogus +Status: Wont fix Bug Type: GetImageSize related -Operating System: WinXP sp1 +Operating System: * -PHP Version: 4.3.1 +PHP Version: 4.3.3 -Assigned To: +Assigned To: helly New Comment:
You realized wrong. We are only reading the 12 bytes that are the same in all formats. Thus the error must by elsewhere. If you find out where feel free to provide a patch. Until then we simply do not support such images. Previous Comments: ------------------------------------------------------------------------ [2003-09-17 18:21:36] [EMAIL PROTECTED] 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.. ------------------------------------------------------------------------ [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