cvs: php4 /ext/gd gd.c php_gd.h
| From: | Rasmus Lerdorf | Date: | Fri, 14 Jul 2000 21:51:31 +0000 |
| Subject: | cvs: php4 /ext/gd gd.c php_gd.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-758@lists.php.net to get a copy of this message | ||
rasmus Fri Jul 14 14:51:31 2000 EDT
Modified files:
/php4/ext/gd gd.c php_gd.h
Log:
Add ImageTypes() function which returns a bitfield with the supported
image formats. 1=gif, 2=jpeg, 4=png and 8=wbmp
@ Add ImageTypes() function which returns a bitfield with the supported
@ image formats. 1=gif, 2=jpeg, 4=png and 8=wbmp (Rasmus)
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.81 php4/ext/gd/gd.c:1.82
--- php4/ext/gd/gd.c:1.81 Mon Jun 26 08:23:52 2000
+++ php4/ext/gd/gd.c Fri Jul 14 14:51:31 2000
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.81 2000/06/26 15:23:52 jah Exp $ */
+/* $Id: gd.c,v 1.82 2000/07/14 21:51:31 rasmus Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -155,6 +155,7 @@
PHP_FE(imagepsslantfont, NULL)
PHP_FE(imagepstext, NULL)
PHP_FE(imagepsbbox, NULL)
+ PHP_FE(imagetypes, NULL)
{NULL, NULL, NULL}
};
@@ -258,6 +259,9 @@
#ifdef HAVE_GD_JPG
php_info_print_table_row(2, "JPG Support", "enabled");
#endif
+#ifdef HAVE_GD_WBMP
+ php_info_print_table_row(2, "WBMP Support", "enabled");
+#endif
php_info_print_table_end();
}
@@ -426,6 +430,25 @@
}
/* }}} */
+/* {{{ proto int imagetypes(void)
+ Return the types of images supported in a bitfield - 1=gif, 2=jpeg, 4=png, 8=wbmp */
+PHP_FUNCTION(imagetypes)
+{
+ int ret=0;
+#ifdef HAVE_GD_GIF
+ ret = 1;
+#endif
+#ifdef HAVE_GD_JPG
+ ret |= 2;
+#endif
+#ifdef HAVE_GD_PNG
+ ret |= 4;
+#endif
+#ifdef HAVE_GD_WBMP
+ ret |= 8;
+#endif
+ RETURN_LONG(ret);
+}
static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn,
gdImagePtr (*func_p)()) {
zval **file;
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.14 php4/ext/gd/php_gd.h:1.15
--- php4/ext/gd/php_gd.h:1.14 Sun Jul 2 16:46:41 2000
+++ php4/ext/gd/php_gd.h Fri Jul 14 14:51:31 2000
@@ -29,7 +29,7 @@
*/
-/* $Id: php_gd.h,v 1.14 2000/07/02 23:46:41 sas Exp $ */
+/* $Id: php_gd.h,v 1.15 2000/07/14 21:51:31 rasmus Exp $ */
#ifndef PHP_GD_H
#define PHP_GD_H
@@ -94,6 +94,7 @@
PHP_FUNCTION(imagecopy);
PHP_FUNCTION(imagecopymerge);
PHP_FUNCTION(imagecopyresized);
+PHP_FUNCTION(imagetypes);
PHP_FUNCTION(imagecreate);
PHP_FUNCTION(imagecreatefromgif);
PHP_FUNCTION(imagecreatefromjpeg);