Skip to content

Commit cfa1028

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: NEWS Fixed Bug #65171 imagescale() fails Revert "Bug #41631: Observe socket read timeouts in SSL streams" Conflicts: ext/openssl/xp_ssl.c
2 parents 2109f5b + 503f819 commit cfa1028

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ext/gd/gd.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5118,11 +5118,23 @@ PHP_FUNCTION(imagescale)
51185118
return;
51195119
}
51205120
method = tmp_m;
5121-
new_width = tmp_w;
5122-
new_height = tmp_h;
51235121

51245122
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
51255123

5124+
if (tmp_h < 0) {
5125+
/* preserve ratio */
5126+
long src_x, src_y;
5127+
5128+
src_x = gdImageSX(im);
5129+
src_y = gdImageSY(im);
5130+
if (src_x) {
5131+
tmp_h = tmp_w * src_y / src_x;
5132+
}
5133+
}
5134+
5135+
new_width = tmp_w;
5136+
new_height = tmp_h;
5137+
51265138
if (gdImageSetInterpolationMethod(im, method)) {
51275139
im_scaled = gdImageScale(im, new_width, new_height);
51285140
}

0 commit comments

Comments
 (0)