From: Marcus Boerger Date: Mon, 18 Nov 2002 16:50:10 +0000 (+0000) Subject: Added colordepth for png X-Git-Tag: RELEASE_1_0b2~148 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3d821c69551851ae9be8203897b1d4c02d74ff8;p=php Added colordepth for png --- diff --git a/ext/standard/image.c b/ext/standard/image.c index a2edc7c820..aef0a27a99 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -276,7 +276,15 @@ static struct gfxinfo *php_handle_swf (php_stream * stream TSRMLS_DC) static struct gfxinfo *php_handle_png (php_stream * stream TSRMLS_DC) { struct gfxinfo *result = NULL; - unsigned char dim[8]; + unsigned char dim[9]; +/* Width: 4 bytes + * Height: 4 bytes + * Bit depth: 1 byte + * Color type: 1 byte + * Compression method: 1 byte + * Filter method: 1 byte + * Interlace method: 1 byte + */ if (php_stream_seek(stream, 8, SEEK_CUR)) return NULL; @@ -287,6 +295,7 @@ static struct gfxinfo *php_handle_png (php_stream * stream TSRMLS_DC) result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); result->width = (((unsigned int)dim[0]) << 24) + (((unsigned int)dim[1]) << 16) + (((unsigned int)dim[2]) << 8) + ((unsigned int)dim[3]); result->height = (((unsigned int)dim[4]) << 24) + (((unsigned int)dim[5]) << 16) + (((unsigned int)dim[6]) << 8) + ((unsigned int)dim[7]); + result->bits = (unsigned int)dim[8]; return result; } /* }}} */