mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
0b8466f268
The bundled libgd always has PNG support, but an external one may not.
31 lines
721 B
PHP
31 lines
721 B
PHP
--TEST--
|
|
Bug #27582 (ImageFillToBorder() on alphablending image looses alpha on fill color)
|
|
--EXTENSIONS--
|
|
gd
|
|
--SKIPIF--
|
|
<?php
|
|
if (!(imagetypes() & IMG_PNG)) {
|
|
die("skip No PNG support");
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$dest = dirname(realpath(__FILE__)) . '/bug27582.png';
|
|
@unlink($dest);
|
|
$im = ImageCreateTrueColor(10, 10);
|
|
imagealphablending($im, true);
|
|
imagesavealpha($im, true);
|
|
$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
|
|
$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
|
|
ImageFillToBorder($im, 5, 5, $bordercolor, $color);
|
|
imagepng($im, $dest);
|
|
|
|
$im2 = imagecreatefrompng($dest);
|
|
$col = imagecolorat($im2, 5, 5);
|
|
$color = imagecolorsforindex($im2, $col);
|
|
echo $color['alpha'];
|
|
@unlink($dest);
|
|
?>
|
|
--EXPECT--
|
|
1
|