1--TEST-- 2Bug #72913 (imagecopy() loses single-color transparency on palette images) 3--EXTENSIONS-- 4gd 5--SKIPIF-- 6<?php 7if (!(imagetypes() & IMG_PNG)) { 8 die("skip No PNG support"); 9} 10?> 11--FILE-- 12<?php 13$base64 = 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAABnRSTlMAAAAAAABu' 14 . 'pgeRAAAAVklEQVRYw+3UQQqAMBAEwf3/p9eTBxEPiWAmWMU8oGFJqgAAuOpzWTX3' 15 . 'xQUti+uRJTZ9V5aY1bOTFZLV7yZr9zt6ibv/qPXfrMpsGipbIy7oqQ8AYJED1plD' 16 . 'y5PCu2sAAAAASUVORK5CYII='; 17$src = imagecreatefromstring(base64_decode($base64)); 18 19$dst = imagecreate(50, 50); 20$transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127); 21imagealphablending($dst, false); 22imagesavealpha($dst, true); 23 24imagecopy($dst, $src, 0,0, 0,0, 50,50); 25 26include_once __DIR__ . '/func.inc'; 27test_image_equals_file(__DIR__ . '/bug72913.png', $dst); 28?> 29--EXPECT-- 30The images are equal. 31