cvs: /php4/ext/standard php_image.h /php4/ext/standard image.h /php4 ChangeLog /php4/ext/standard image.c php3_standard.h

From: Date: Thu, 02 Sep 1999 11:58:23 +0000
Subject: cvs: /php4/ext/standard php_image.h /php4/ext/standard image.h /php4 ChangeLog /php4/ext/standard image.c php3_standard.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-3995@lists.php.net to get a copy of this message
thies Thu Sep 2 07:58:23 1999 EDT Added files: /php4/ext/standard php_image.h Removed files: /php4/ext/standard image.h Modified files: /php4 ChangeLog /php4/ext/standard image.c php3_standard.h Log: newest GetImageSize renamed header-file Index: php4/ChangeLog diff -u php4/ChangeLog:1.75 php4/ChangeLog:1.76 --- php4/ChangeLog:1.75 Thu Sep 2 00:26:48 1999 +++ php4/ChangeLog Thu Sep 2 07:58:22 1999 @@ -2,6 +2,7 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ?? 1999, Version 4.0 Beta 3 +- Ported newest GetImageSize (Thies) - Added session compile support in Win32 (Andi) - Added -d switch to the CGI binary that allows overriding php.ini values from the command line (Zeev) Index: php4/ext/standard/image.c diff -u php4/ext/standard/image.c:1.5 php4/ext/standard/image.c:1.6 --- php4/ext/standard/image.c:1.5 Mon Aug 2 15:16:50 1999 +++ php4/ext/standard/image.c Thu Sep 2 07:58:23 1999 @@ -15,7 +15,7 @@ | Authors: Rasmus Lerdorf | +----------------------------------------------------------------------+ */ -/* $Id: image.c,v 1.5 1999/08/02 19:16:50 zeev Exp $ */ +/* $Id: image.c,v 1.6 1999/09/02 11:58:23 thies Exp $ */ /* * Based on Daniel Schmitt's imageinfo.c which carried the following * Copyright notice. @@ -45,7 +45,7 @@ #if HAVE_UNISTD_H #include <unistd.h> #endif -#include "image.h" +#include "php_image.h" /* file type markers */ const char php3_sig_gif[3] = @@ -62,6 +62,8 @@ struct gfxinfo { unsigned int width; unsigned int height; + unsigned int bits; + unsigned int channels; }; /* routine to handle GIF files. If only everything were that easy... ;} */ @@ -70,7 +72,7 @@ struct gfxinfo *result = NULL; unsigned char a[2]; - result = (struct gfxinfo *) emalloc(sizeof(struct gfxinfo)); + result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo)); fseek(fp, 6L, SEEK_SET); fread(a,sizeof(a),1,fp); result->width = (unsigned short)a[0] | (((unsigned short)a[1])<<8); @@ -96,7 +98,7 @@ struct gfxinfo *result = NULL; unsigned long in_width, in_height; - result = (struct gfxinfo *) emalloc(sizeof(struct gfxinfo)); + result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo)); fseek(fp, 16L, SEEK_SET); in_width = php3_read4(fp); in_height = php3_read4(fp); @@ -211,7 +213,6 @@ { struct gfxinfo *result = NULL; unsigned int marker; - unsigned short in_width, in_height; fseek(fp, 0L, SEEK_SET); /* position file pointer on SOF */ @@ -239,20 +240,20 @@ case M_SOF15: if (result == NULL) { /* handle SOFn block */ - fseek(fp, 3L, SEEK_CUR); /* skip length and precision bytes */ - in_height = php3_read2(fp); - in_width = php3_read2(fp); - /* fill a gfxinfo struct to return the data */ - result = (struct gfxinfo *) emalloc(sizeof(struct gfxinfo)); - - result->width = (unsigned int) in_width; - result->height = (unsigned int) in_height; - + result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo)); + + fseek(fp, 2, SEEK_CUR); + + result->bits = fgetc(fp); + result->height = php3_read2(fp); + result->width = php3_read2(fp); + result->channels = fgetc(fp); + if (! info) /* if we don't want an extanded info -> return */ return result; } else { php3_skip_variable(fp); - } + } break; case M_APP0: @@ -321,6 +322,7 @@ } pval_destructor(info); + if (array_init(info) == FAILURE) { return; } @@ -369,6 +371,13 @@ add_index_long(return_value, 2, itype); sprintf(temp, "width=\"%d\" height=\"%d\"", result->width, result->height); /* safe */ add_index_string(return_value, 3, temp, 1); + + if (result->bits != 0) { + add_assoc_long(return_value,"bits",result->bits); + } + if (result->channels != 0) { + add_assoc_long(return_value,"channels",result->channels); + } efree(result); } Index: php4/ext/standard/php3_standard.h diff -u php4/ext/standard/php3_standard.h:1.5 php4/ext/standard/php3_standard.h:1.6 --- php4/ext/standard/php3_standard.h:1.5 Sat Jun 12 13:50:39 1999 +++ php4/ext/standard/php3_standard.h Thu Sep 2 07:58:23 1999 @@ -28,7 +28,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php3_standard.h,v 1.5 1999/06/12 17:50:39 zeev Exp $ */ +/* $Id: php3_standard.h,v 1.6 1999/09/02 11:58:23 thies Exp $ */ #include "basic_functions.h" #include "phpmath.h" @@ -53,7 +53,7 @@ #include "cyr_convert.h" #include "php3_link.h" #include "fsock.h" -#include "image.h" +#include "php_image.h" #include "php3_iptc.h" #include "info.h" #include "uniqid.h"

« previous php.version4 (#3995) next »