helly Tue Nov 12 06:49:12 2002 EDT
Modified files:
/php4/ext/gd gd.c php_gd.h
Log:
new function gd_info() returns an associative array of gd support options. # The
index names are those from the minfo function. Therefore it is
# easy to look into phpinfo() to see which index names are possible.
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.220 php4/ext/gd/gd.c:1.221
--- php4/ext/gd/gd.c:1.220 Wed Oct 30 12:54:36 2002
+++ php4/ext/gd/gd.c Tue Nov 12 06:49:11 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.220 2002/10/30 17:54:36 helly Exp $ */
+/* $Id: gd.c,v 1.221 2002/11/12 11:49:11 helly Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -117,6 +117,7 @@
/* {{{ gd_functions[]
*/
function_entry gd_functions[] = {
+ PHP_FE(gd_info, NULL)
PHP_FE(imagearc,
NULL)
PHP_FE(imageellipse, NULL)
PHP_FE(imagechar,
NULL)
@@ -415,6 +416,82 @@
php_info_print_table_row(2, "XBM Support", "enabled");
#endif
php_info_print_table_end();
+}
+/* }}} */
+
+/* {{{ proto array gd_info()
+ */
+PHP_FUNCTION(gd_info)
+{
+ if (ZEND_NUM_ARGS()!=0) {
+ ZEND_WRONG_PARAM_COUNT();
+ RETURN_FALSE;
+ }
+
+ if (array_init(return_value) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize
+array");
+ RETURN_FALSE;
+ }
+#if HAVE_GD_BUNDLED
+ add_assoc_string(return_value, "GD Version", "bundled (2.0 compatible)", 1);
+#elif HAVE_LIBGD20
+ add_assoc_string(return_value, "GD Version", "2.0 or higher", 1);
+#elif HAVE_GDIMAGECOLORRESOLVE
+ add_assoc_string(return_value, "GD Version", "1.6.2 or higher", 1);
+#elif HAVE_LIBGD13
+ add_assoc_string(return_value, "GD Version", "between 1.3 and 1.6.1", 1);
+#else
+ add_assoc_string(return_value, "GD Version", "1.2", 1);
+#endif
+
+#ifdef ENABLE_GD_TTF
+ add_assoc_bool(return_value, "FreeType Support", 1);
+#if HAVE_LIBFREETYPE
+ add_assoc_string(return_value, "FreeType Linkage", "with freetype", 1);
+#elif HAVE_LIBTTF
+ add_assoc_string(return_value, "FreeType Linkage", "with TTF library", 1);
+#else
+ add_assoc_string(return_value, "FreeType Linkage", "with unknown library", 1);
+#endif
+#else
+ add_assoc_bool(return_value, "FreeType Support", 0);
+#endif
+
+#ifdef HAVE_LIBT1
+ add_assoc_bool(return_value, "T1Lib Support", 1);
+#else
+ add_assoc_bool(return_value, "T1Lib Support", 0);
+#endif
+#ifdef HAVE_GD_GIF_READ
+ add_assoc_bool(return_value, "GIF Read Support", 1);
+#else
+ add_assoc_bool(return_value, "GIF Read Support", 0);
+#endif
+#ifdef HAVE_GD_GIF_CREATE
+ add_assoc_bool(return_value, "GIF Create Support", 1);
+#else
+ add_assoc_bool(return_value, "GIF Create Support", 0);
+#endif
+#ifdef HAVE_GD_JPG
+ add_assoc_bool(return_value, "JPG Support", 1);
+#else
+ add_assoc_bool(return_value, "JPG Support", 0);
+#endif
+#ifdef HAVE_GD_PNG
+ add_assoc_bool(return_value, "PNG Support", 1);
+#else
+ add_assoc_bool(return_value, "PNG Support", 0);
+#endif
+#ifdef HAVE_GD_WBMP
+ add_assoc_bool(return_value, "WBMP Support", 1);
+#else
+ add_assoc_bool(return_value, "WBMP Support", 0);
+#endif
+#ifdef HAVE_GD_XBM
+ add_assoc_bool(return_value, "XBM Support", 1);
+#else
+ add_assoc_bool(return_value, "XBM Support", 0);
+#endif
}
/* }}} */
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.43 php4/ext/gd/php_gd.h:1.44
--- php4/ext/gd/php_gd.h:1.43 Mon Oct 28 20:15:43 2002
+++ php4/ext/gd/php_gd.h Tue Nov 12 06:49:11 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_gd.h,v 1.43 2002/10/29 01:15:43 iliaa Exp $ */
+/* $Id: php_gd.h,v 1.44 2002/11/12 11:49:11 helly Exp $ */
#ifndef PHP_GD_H
#define PHP_GD_H
@@ -59,6 +59,7 @@
PHP_MINIT_FUNCTION(gd);
PHP_MSHUTDOWN_FUNCTION(gd);
+PHP_FUNCTION(gd_info);
PHP_FUNCTION(imagearc);
PHP_FUNCTION(imagechar);
PHP_FUNCTION(imagecharup);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php