]> granicus.if.org Git - php/commitdiff
Add ImageTypes() function which returns a bitfield with the supported
authorRasmus Lerdorf <rasmus@php.net>
Fri, 14 Jul 2000 21:51:31 +0000 (21:51 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Fri, 14 Jul 2000 21:51:31 +0000 (21:51 +0000)
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)

ext/gd/gd.c
ext/gd/php_gd.h

index e16b0caf2244388a89cf3f00985c9e389671e9c2..d0bc3408aa94b1d6ec3bcfeab91b0a01b2041d02 100644 (file)
@@ -155,6 +155,7 @@ function_entry gd_functions[] = {
        PHP_FE(imagepsslantfont,                                                NULL)
        PHP_FE(imagepstext,                                                             NULL)
        PHP_FE(imagepsbbox,                                                             NULL)
+       PHP_FE(imagetypes,                                                              NULL)
        {NULL, NULL, NULL}
 };
 
@@ -257,6 +258,9 @@ PHP_MINFO_FUNCTION(gd)
 #endif
 #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 @@ PHP_FUNCTION(imagecreate)
 }
 /* }}} */
 
+/* {{{ 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 19d1b8de764c0a382c4361845e2caf05ad1008ac..8dda74591df92cc16d0b281cb3ffdc28c8d299b2 100644 (file)
@@ -94,6 +94,7 @@ PHP_FUNCTION(imagecolortransparent);
 PHP_FUNCTION(imagecopy);
 PHP_FUNCTION(imagecopymerge);
 PHP_FUNCTION(imagecopyresized);
+PHP_FUNCTION(imagetypes);
 PHP_FUNCTION(imagecreate);
 PHP_FUNCTION(imagecreatefromgif);
 PHP_FUNCTION(imagecreatefromjpeg);