我尝试制作水印,但GD库显示了黑色背景
function addWatermark($image)
{
$image = imagecreatefrompng($image);
$textcolor = imagecolorallocate($image, 255, 255,255);
imagettftext($image, 14, 0, imagesx($image)-125, imagesy($image)-20, $textcolor, 'arial.ttf', "Matin");
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
}
<img src="<?php echo addWatermark("download.png") ?>" width="300" title="mm" alt="">