tony2001                Tue May 22 09:44:55 2007 UTC

  Added files:                 
    /php-src/ext/gd/tests       bug41442.phpt 

  Modified files:              
    /php-src/ext/gd     gd.c 
  Log:
  fix #41442 (imagegd2() under output control)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.374&r2=1.375&diff_format=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.374 php-src/ext/gd/gd.c:1.375
--- php-src/ext/gd/gd.c:1.374   Mon May  7 14:50:07 2007
+++ php-src/ext/gd/gd.c Tue May 22 09:44:55 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd.c,v 1.374 2007/05/07 14:50:07 pajoye Exp $ */
+/* $Id: gd.c,v 1.375 2007/05/22 09:44:55 tony2001 Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
    Cold Spring Harbor Labs. */
@@ -2563,6 +2563,14 @@
                        }
                        (*func_p)(im, fp);
                        break;
+#ifdef HAVE_GD_GD2
+               case PHP_GDIMG_TYPE_GD2:
+                       if (quality == -1) {
+                               quality = 128;
+                       }
+                       (*func_p)(im, fp, quality, type);
+                       break;
+#endif
                default:
                        if (quality == -1) {
                                quality = 128;

http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug41442.phpt?view=markup&rev=1.1
Index: php-src/ext/gd/tests/bug41442.phpt
+++ php-src/ext/gd/tests/bug41442.phpt
--TEST--
Bug #41442 (imagegd2() under output control)
--SKIPIF--
<?php 
        if (!extension_loaded('gd')) {
                die("skip gd extension not available.");
        }
        if (!function_exists("imagegd2")) {
                die("skip GD2 support unavailable");
        }
?>
--FILE--
<?php

$str = file_get_contents(dirname(__FILE__).'/src.gd2');
$res = imagecreatefromstring($str);

/* string */
ob_start();
imagegd2($res);
$str2 = ob_get_clean();
var_dump(imagecreatefromstring($str2));

/* file */
$file = dirname(__FILE__)."/bug41442.gd2";
imagegd2($res, $file);
$str2 = file_get_contents($file);
var_dump(imagecreatefromstring($str2));

@unlink($file);

echo "Done\n";
?>
--EXPECTF--     
resource(%d) of type (gd)
resource(%d) of type (gd)
Done

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

Reply via email to