Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/gd/libgd/gd_rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ gdImagePtr gdImageRotate90 (gdImagePtr src, int ignoretransparent)
if (dst != NULL) {
int old_blendmode = dst->alphaBlendingFlag;
dst->alphaBlendingFlag = 0;

dst->saveAlphaFlag = 1;
dst->transparent = src->transparent;

gdImagePaletteCopy (dst, src);
Expand Down Expand Up @@ -263,7 +263,7 @@ gdImagePtr gdImageRotate180 (gdImagePtr src, int ignoretransparent)
if (dst != NULL) {
int old_blendmode = dst->alphaBlendingFlag;
dst->alphaBlendingFlag = 0;

dst->saveAlphaFlag = 1;
dst->transparent = src->transparent;

gdImagePaletteCopy (dst, src);
Expand Down Expand Up @@ -311,7 +311,7 @@ gdImagePtr gdImageRotate270 (gdImagePtr src, int ignoretransparent)
if (dst != NULL) {
int old_blendmode = dst->alphaBlendingFlag;
dst->alphaBlendingFlag = 0;

dst->saveAlphaFlag = 1;
dst->transparent = src->transparent;

gdImagePaletteCopy (dst, src);
Expand Down
93 changes: 93 additions & 0 deletions ext/gd/tests/gh10614.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
--TEST--
GH-10614 (imagerotate will turn the picture all black, when rotated 90)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.4', '>=')) die("skip test requires GD 2.3.4 or older");
?>
--FILE--
<?php

$input = imagecreatefrompng(__DIR__ . '/gh10614.png');

for ($angle = 0; $angle <= 270; $angle += 90) {
echo "--- Angle $angle ---\n";
$output = imagerotate($input, $angle, 0);
for ($i = 0; $i < 4; $i++) {
for ($j = 0; $j < 4; $j++) {
var_dump(dechex(imagecolorat($output, $i, $j)));
}
}
}

?>
--EXPECT--
--- Angle 0 ---
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
--- Angle 90 ---
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
--- Angle 180 ---
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
string(1) "0"
--- Angle 270 ---
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
string(1) "0"
string(1) "0"
string(8) "7f000000"
string(8) "7f000000"
Binary file added ext/gd/tests/gh10614.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.