summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/gd/gd.c25
-rw-r--r--ext/gd/libgd/gd.h2
2 files changed, 14 insertions, 13 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index fcde3dbaf7..98d15579e6 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1418,10 +1418,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);
@@ -1481,22 +1487,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 5031509c71..a08df2892d 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -228,6 +228,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