]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Wed, 4 Dec 2002 21:07:10 +0000 (21:07 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 4 Dec 2002 21:07:10 +0000 (21:07 +0000)
ext/gd/gd.c
ext/gd/libgd/gd.h

index ab0d41322bf96a9535be8c025e65964f7c7159b5..aad7eb61ebfb0bf08ac63b061d83d2bdde197416 100644 (file)
@@ -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)
index 21c3c5515b2581a4be329926946ed2aa9eca67ef..d626cb165b6fc422fc83a6364f26481c080834a0 100644 (file)
@@ -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