Skip to content

Commit 490da4f

Browse files
author
Ilia Alshanetsky
committed
Fixed bug #24155 (gdImageRotate270 incorrectly use x parameter for y axis)
1 parent 3a75403 commit 490da4f

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

ext/gd/libgd/gd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2613,7 +2613,7 @@ gdImagePtr gdImageRotate270 ( gdImagePtr src )
26132613
if (dst != NULL) {
26142614
gdImagePaletteCopy (dst, src);
26152615

2616-
for (uY = 0; uY<src->sx; uY++) {
2616+
for (uY = 0; uY<src->sy; uY++) {
26172617
for (uX = 0; uX<src->sx; uX++) {
26182618
c = f (src, uX, uY);
26192619
gdImageSetPixel(dst, (dst->sx - uY - 1), uX, c);

ext/gd/tests/bug24155.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Bug #24155 (gdImageRotate270 rotation problem).
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) {
6+
die("skip gd extension not available\n");
7+
}
8+
if (!GD_BUNDLED) {
9+
die('skip external GD libraries may fail');
10+
}
11+
?>
12+
--FILE--
13+
<?php
14+
$dest = dirname(realpath(__FILE__)) . 'bug24155.png';
15+
@unlink($dest);
16+
17+
$im = imagecreatetruecolor(30, 50);
18+
imagefill($im, 0, 0, (16777215 - 255));
19+
$im = imagerotate($im, 270, 255);
20+
imagepng($im, $dest);
21+
22+
echo md5_file($dest) . "\n";
23+
@unlink($dest);
24+
?>
25+
--EXPECT--
26+
cc867fd65c30883463ce58d0341f0997

0 commit comments

Comments
 (0)