mirror of
https://github.com/php/php-src.git
synced 2025-01-23 20:23:31 +08:00
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.
This commit is contained in:
parent
3ba7df4c6a
commit
597acbc3d3
77
ext/gd/gd.c
77
ext/gd/gd.c
@ -117,6 +117,7 @@ static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold
|
||||
/* {{{ gd_functions[]
|
||||
*/
|
||||
function_entry gd_functions[] = {
|
||||
PHP_FE(gd_info, NULL)
|
||||
PHP_FE(imagearc, NULL)
|
||||
PHP_FE(imageellipse, NULL)
|
||||
PHP_FE(imagechar, NULL)
|
||||
@ -418,6 +419,82 @@ PHP_MINFO_FUNCTION(gd)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ 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
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */
|
||||
PHP_GD_API int phpi_get_le_gd(void)
|
||||
{
|
||||
|
@ -59,6 +59,7 @@ PHP_MINFO_FUNCTION(gd);
|
||||
PHP_MINIT_FUNCTION(gd);
|
||||
PHP_MSHUTDOWN_FUNCTION(gd);
|
||||
|
||||
PHP_FUNCTION(gd_info);
|
||||
PHP_FUNCTION(imagearc);
|
||||
PHP_FUNCTION(imagechar);
|
||||
PHP_FUNCTION(imagecharup);
|
||||
|
Loading…
Reference in New Issue
Block a user