diff --git a/NEWS b/NEWS index 8117d60f2de..acf58500a9e 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ PHP NEWS - GD: . Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb) + . Fixed bug #73272 (imagescale() is not affected by, but affects + imagesetinterpolation()). (cmb) - phpdbg: . Properly allow for stdin input from a file. (Bob) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 62433c58bab..2aa03a95519 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -4695,7 +4695,7 @@ PHP_FUNCTION(imagescale) gdImagePtr im_scaled = NULL; int new_width, new_height; zend_long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED; - gdInterpolationMethod method; + gdInterpolationMethod method, old_method; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) { return; @@ -4724,9 +4724,12 @@ PHP_FUNCTION(imagescale) new_width = tmp_w; new_height = tmp_h; + /* gdImageGetInterpolationMethod() is only available as of GD 2.1.1 */ + old_method = im->interpolation_id; if (gdImageSetInterpolationMethod(im, method)) { im_scaled = gdImageScale(im, new_width, new_height); } + gdImageSetInterpolationMethod(im, old_method); if (im_scaled == NULL) { RETURN_FALSE; diff --git a/ext/gd/tests/bug73272.phpt b/ext/gd/tests/bug73272.phpt new file mode 100644 index 00000000000..3bb710cdc7d --- /dev/null +++ b/ext/gd/tests/bug73272.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation()) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +The images are equal. +===DONE=== diff --git a/ext/gd/tests/bug73272.png b/ext/gd/tests/bug73272.png new file mode 100644 index 00000000000..97bfadf983e Binary files /dev/null and b/ext/gd/tests/bug73272.png differ