您好,很抱歉打扰各位了,
在使用我创建的函数处理图像后,我试图将图像合并在一起,但它不起作用,
有任何想法吗?
error_reporting(E_ALL);
ini_set('display_errors', 1);
function tester($image,$r,$g,$b) {
$img = imagecreatefrompng($image);
imagealphablending($img, false);
imagesavealpha($img, true);
imagefilter($img, IMG_FILTER_COLORIZE, $r,$g, $b);
return $img;
}
header("Content-type: image/png");
$image_1 = tester("1.png",123,111,0);
$image_2 = tester("2.png",123,111,0);
$x1 = imagesx($image_1);
$y1 = imagesy($image_1);
$x2 = imagesx($image_2);
$y2 = imagesy($image_2);
$slate = imagecreatetruecolor(max($x1, $x2), max($y1, $y2));
$transparent = imagecolorallocatealpha($slate,0,255,0,127);
imagefill($slate,0,0,$transparent);
imagecopy($slate, $image_1, 0, 0, 0, 0, imagesx($image_1)-1, imagesy($image_1)-1);
imagecopy($slate, $image_2, 0, 0, 0, 0, imagesx($image_2)-1, imagesy($image_2)-1);
imagepng($slate);
imagedestroy($slate);