]> granicus.if.org Git - php/commitdiff
wbmp conversion warning fix.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 22 Feb 2004 18:03:09 +0000 (18:03 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 22 Feb 2004 18:03:09 +0000 (18:03 +0000)
ext/gd/gd.c

index 3065fd81b21480a959cf4fdfc7ee66b924e6b52e..f090f1d63d2192607397bae2e60b140c88b1639b 100644 (file)
@@ -1721,7 +1721,9 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
 
                switch (image_type) {
                        case PHP_GDIMG_CONVERT_WBM:
-                               if (q < 0 || q > 255) {
+                               if (q == -1) {
+                                       q = 0;
+                               } else if (q < 0 || q > 255) {
                                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
                                        q = 0;
                                }
@@ -1766,9 +1768,12 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
 
                switch (image_type) {
                        case PHP_GDIMG_CONVERT_WBM:
-                               if (q < 0 || q > 255) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
-                               }
+                               if (q == -1) {
+                                       q = 0;
+                               } else if (q < 0 || q > 255) {
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
+                                       q = 0;
+                               }
                                gdImageWBMP(im, q, tmp);
                                break;
                        case PHP_GDIMG_TYPE_JPG: