]> granicus.if.org Git - php/commitdiff
Fix imagegd crashes when used with truecolor image (from jpeg,png, or imagecreatetrue...
authorPierre Joye <pajoye@php.net>
Wed, 4 Dec 2002 02:37:21 +0000 (02:37 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 4 Dec 2002 02:37:21 +0000 (02:37 +0000)
may we add parameters to imagegd to let user specify the palette size and dither (set to 256 and true) ?

ext/gd/gd.c

index 14e1a86d24b5f5122b13c54a689dc907aa92a580..00b7746432b530e9bd64d6d1f96ace1c7ca74223 100644 (file)
@@ -1589,6 +1589,12 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
                                }
                                (*func_p)(im, i, fp);
                                break;
+                       case PHP_GDIMG_TYPE_GD:
+                               if(im->trueColor){
+                                       gdImageTrueColorToPalette(im,1,255);
+                               }
+                               (*func_p)(im, fp);
+                               break;
                        default:
                                (*func_p)(im, fp);
                                break;