Commit:    8075f1f4a37804d00b35556826d378de513f7a8c
Author:    Remi Collet <r...@php.net>         Mon, 24 Jun 2013 11:10:52 +0200
Parents:   b4632d0c1249bf0042324eb83cd11339c977a441
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=8075f1f4a37804d00b35556826d378de513f7a8c

Log:
Use same logic to load WebP image that other formats

Changed paths:
  M  NEWS
  M  ext/gd/gd.c


Diff:
diff --git a/NEWS b/NEWS
index 2d35499..2df33bc 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ OPcache
     imagerotate). (Pierre)
   . Fixed Bug #65060 (imagecreatefrom... crashes with user streams). (Remi)
   . Fixed Bug #65084 (imagecreatefromjpeg fails with URL). (Remi)
+  . Fix gdImageCreateFromWebpCtx and use same logic to load WebP image
+    that other formats. (Remi)
 
 - Intl:
   . Fixed bug #62759: Buggy grapheme_substr() on edge case. (Stas)
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 49370a7..9bdedee 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -2367,23 +2367,6 @@ static void 
_php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
                RETURN_FALSE;
        }
 
-       if (image_type == PHP_GDIMG_TYPE_WEBP) {
-               size_t buff_size;
-               char *buff;
-
-               /* needs to be malloc (persistent) - GD will free() it later */
-               buff_size = php_stream_copy_to_mem(stream, &buff, 
PHP_STREAM_COPY_ALL, 1);
-               if (!buff_size) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot read 
image data");
-                       goto out_err;
-               }
-               im = (*ioctx_func_p)(buff_size, buff);
-               if (!im) {
-                       goto out_err;
-               }
-               goto register_im;
-       }
-
        /* try and avoid allocating a FILE* if the stream is not naturally a 
FILE* */
        if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) {
                if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, 
(void**)&fp, REPORT_ERRORS)) {
@@ -2499,7 +2482,7 @@ PHP_FUNCTION(imagecreatefrompng)
    Create a new image from PNG file or URL */
 PHP_FUNCTION(imagecreatefromwebp)
 {
-       _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
PHP_GDIMG_TYPE_WEBP, "WEBP", gdImageCreateFromWebpPtr, 
gdImageCreateFromWebpPtr);
+       _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
PHP_GDIMG_TYPE_WEBP, "WEBP", gdImageCreateFromWebp, gdImageCreateFromWebpCtx);
 }
 /* }}} */
 #endif /* HAVE_GD_VPX */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to