1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 21:41:22 +02:00
Files
archived-php-src/ext/gd/tests/bug73291.phpt
Christoph M. Becker a375d54785 Migrate skip checks to --EXTENSIONS-- for ext/gd
Cf. PR #6787.

Closes GH-6994.
2021-05-22 15:38:51 +02:00

32 lines
734 B
PHP

--TEST--
Bug #73291 (imagecropauto() $threshold differs from external libgd)
--EXTENSIONS--
gd
--FILE--
<?php
$src = imagecreatetruecolor(255, 255);
$white = imagecolorallocate($src, 255, 255, 255);
imagefilledrectangle($src, 0, 0, 254, 254, $white);
for ($i = 254; $i > 0; $i--) {
$color = imagecolorallocate($src, $i, $i, $i);
imagefilledellipse($src, 127, 127, $i, $i, $color);
}
foreach ([0.1, 0.5, 1.0, 10.0] as $threshold) {
$dst = imagecropauto($src, IMG_CROP_THRESHOLD, $threshold, $white);
if ($dst !== false) {
printf("size: %d*%d\n", imagesx($dst), imagesy($dst));
} else {
echo "cropped to zero size\n";
}
}
?>
--EXPECT--
size: 247*247
size: 237*237
size: 229*229
size: 175*175