Browse Source

- add compression mode argument to imagepng

(MFH to 5.1?)
migration/RELEASE_1_0_0
Pierre Joye 21 years ago
parent
commit
d8b5fb88cd
  1. 4
      ext/gd/gd.c
  2. 2
      ext/gd/gd_ctx.c

4
ext/gd/gd.c

@ -1851,12 +1851,12 @@ PHP_FUNCTION(imagegif)
#endif /* HAVE_GD_GIF_CREATE */
#ifdef HAVE_GD_PNG
/* {{{ proto bool imagepng(resource im [, string filename])
/* {{{ proto bool imagepng(resource im [, string filename [, int quality]])
Output PNG image to browser or file */
PHP_FUNCTION(imagepng)
{
#ifdef USE_GD_IOCTX
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePngCtx);
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePngCtxEx);
#else
_php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePng);
#endif

2
ext/gd/gd_ctx.c

@ -80,7 +80,6 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
q = Z_LVAL_PP(quality);/* or colorindex for foreground of BW images (defaults to black) */
}
}
if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) {
if (!fn || php_check_open_basedir(fn TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(fn, "rb+", CHECKUID_CHECK_FILE_AND_DIR))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filename '%s'", fn);
@ -117,6 +116,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
}
case PHP_GDIMG_TYPE_JPG:
case PHP_GDIMG_TYPE_PNG:
(*func_p)(im, ctx, q);
break;
case PHP_GDIMG_TYPE_XBM:

Loading…
Cancel
Save