我无法使其透明,而在底部会使最后7行变黑。
<?php
/* header ('Content-Type: image/png'); */
$x = 20;
$y = 34;
$padding=2;
$finalImage = imagecreate($x+$padding,$y+$padding) or die('Cannot Initialize new GD image stream');
$white = imagecolorallocatealpha($finalImage, 255, 255, 255, 127);
imagefill($finalImage, 0, 0, $white);
imagefill($finalImage,0,0,0x7fff0000); // this is suppose to make it transparent
$url = 'http://65.82.88.75/queuecam/marker_red.png';
$originalImage = imagecreatefrompng($url);
imagecopymerge($finalImage,$originalImage,($padding/2),($padding/2),0,0,$x,$y,100);
// final, Original, final x, final y, Original x, Original y, Source width, Source height, **ptc
$text_color = imagecolorallocate($finalImage,0,0,0); // color of text
imagefill($finalImage,0,0,0x7fff0000);
imagestring($finalImage,5, 6, 2, '1', $text_color); // finalImage, font size, left, top, TEXT, color
imagepng($finalImage,'test.png');
imagedestroy($finalImage);
?>
这需要GD库。是否有可能发生这种情况,因为我没有将它安装在我的电脑中?没有GD会有同样的方法吗?