From fcbde2dad44ce10c80767177036b8dabbc84eba2 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 4 Dec 2002 21:07:10 +0000 Subject: [PATCH] MFH --- ext/gd/gd.c | 25 ++++++++++++------------- ext/gd/libgd/gd.h | 2 ++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index ab0d41322b..aad7eb61eb 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1354,10 +1354,16 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, } if (!im && fp) { - if (image_type == PHP_GDIMG_TYPE_GD2PART) { - im = (*func_p)(fp, Z_LVAL_PP(srcx), Z_LVAL_PP(srcy), Z_LVAL_PP(width), Z_LVAL_PP(height)); - } else { - im = (*func_p)(fp); + switch (image_type) { + case PHP_GDIMG_TYPE_GD2PART: + im = (*func_p)(fp, Z_LVAL_PP(srcx), Z_LVAL_PP(srcy), Z_LVAL_PP(width), Z_LVAL_PP(height)); + break; + case PHP_GDIMG_TYPE_XPM: + im = gdImageCreateFromXpm(fn); + break; + default: + im = (*func_p)(fp); + break; } fflush(fp); @@ -1417,22 +1423,15 @@ PHP_FUNCTION(imagecreatefromxbm) /* }}} */ #endif /* HAVE_GD_XBM */ +#ifdef HAVE_GD_XPM /* {{{ proto int imagecreatefromxpm(string filename) Create a new image from XPM file or URL */ PHP_FUNCTION(imagecreatefromxpm) { - /* -#ifdef HAVE_GD_XPM _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XPM, "XPM", gdImageCreateFromXpm, NULL); -#else - */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No XPM support in this PHP build"); - RETURN_FALSE; - /* -#endif - */ } /* }}} */ +#endif #ifdef HAVE_GD_WBMP /* {{{ proto int imagecreatefromwbmp(string filename) diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h index 21c3c5515b..d626cb165b 100644 --- a/ext/gd/libgd/gd.h +++ b/ext/gd/libgd/gd.h @@ -223,6 +223,8 @@ gdImagePtr gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy, int w, gdImagePtr gdImageCreateFromXbm(FILE *fd); +gdImagePtr gdImageCreateFromXpm (char *filename); + void gdImageDestroy(gdImagePtr im); /* Replaces or blends with the background depending on the -- 2.50.1