summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2005-10-08 19:29:04 +0000
committerPierre Joye <pajoye@php.net>2005-10-08 19:29:04 +0000
commitd8b5fb88cd8b222ae946e7d93540e2fb0f0bf195 (patch)
tree2e4db3671dd923531bb1a4f3b70cd2e44f25aa00
parent033ffc206d96e7f40882d7b7f3085ad97616ef1b (diff)
downloadphp-git-d8b5fb88cd8b222ae946e7d93540e2fb0f0bf195.tar.gz
- add compression mode argument to imagepng
(MFH to 5.1?)
-rw-r--r--ext/gd/gd.c4
-rw-r--r--ext/gd/gd_ctx.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 361076dc4c..76fb2347d2 100644
--- a/ext/gd/gd.c
+++ b/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
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index 99cf87a170..c315b870ea 100644
--- a/ext/gd/gd_ctx.c
+++ b/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: