diff options
| author | foobar <sniper@php.net> | 2001-04-01 05:42:07 +0000 |
|---|---|---|
| committer | foobar <sniper@php.net> | 2001-04-01 05:42:07 +0000 |
| commit | f663f1edab70f294311505cbeb1910ddbd5956d5 (patch) | |
| tree | 385f31c37fac9a72f8ed955236f4b374465ddebc /ext/gd/gd_ctx.c | |
| parent | f29c9900b16fc2007945f59a615c51ae19177ab8 (diff) | |
| download | php-git-f663f1edab70f294311505cbeb1910ddbd5956d5.tar.gz | |
Fixed bug #8137 and killed some compile warnings.
Diffstat (limited to 'ext/gd/gd_ctx.c')
| -rw-r--r-- | ext/gd/gd_ctx.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index f187483e23..b3e51b7653 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -24,13 +24,12 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *fn = NULL; FILE *fp = NULL; int argc = ZEND_NUM_ARGS(); - int q = -1; + int q = -1, i; gdIOCtx *ctx; GDLS_FETCH(); - /* The quality parameter for Wbmp stands for the threshold - So the q variable */ - + /* The quality parameter for Wbmp stands for the threshold when called from image2wbmp() */ + if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &imgind, &file, &quality) == FAILURE) { WRONG_PARAM_COUNT; @@ -75,14 +74,19 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, } switch(image_type) { + case PHP_GDIMG_CONVERT_WBM: + if(q<0||q>255) { + php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q); + } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, ctx, q); break; case PHP_GDIMG_TYPE_WBM: - if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q); - } - /* break missing intentionally */ + for(i=0; i < im->colorsTotal; i++) { + if(im->red[i] == 0) break; + } + (*func_p)(im, i, ctx); + break; default: (*func_p)(im, ctx); break; |
