|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? 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)
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include "image.h"
+#include "php_image.h"
/* file type markers */
const char php3_sig_gif[3] =
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... ;} */
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);
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);
{
struct gfxinfo *result = NULL;
unsigned int marker;
- unsigned short in_width, in_height;
fseek(fp, 0L, SEEK_SET); /* position file pointer on SOF */
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:
}
pval_destructor(info);
+
if (array_init(info) == FAILURE) {
return;
}
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);
}
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | PHP HTML Embedded Scripting Language Version 3.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or modify |
- | it under the terms of one of the following licenses: |
- | |
- | A) the GNU General Public License as published by the Free Software |
- | Foundation; either version 2 of the License, or (at your option) |
- | any later version. |
- | |
- | B) the PHP License as published by the PHP Development Team and |
- | included in the distribution in the file: LICENSE |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of both licenses referred to here. |
- | If you did not, or have any questions about PHP licensing, please |
- | contact core@php.net. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _IMAGE_H
-#define _IMAGE_H
-
-PHP_FUNCTION(getimagesize);
-
-#endif /* _IMAGE_H */
#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"
--- /dev/null
+/*
+ +----------------------------------------------------------------------+
+ | PHP version 4.0 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997, 1998, 1999 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available at through the world-wide-web at |
+ | http://www.php.net/license/2_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Rasmus Lerdorf |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef _IMAGE_H
+#define _IMAGE_H
+
+PHP_FUNCTION(getimagesize);
+
+#endif /* _IMAGE_H */