1
我已经尝试了几次,但我似乎无法得到透明背景腓添加居中文本图像
任何建议这个图片文字底部的2线为中心?
<?php
$filePath = "adopt.png"; //full path to your png, including filename and extension
$img = @imagecreatefrompng($filePath);
$width = imagesx($img);
$height = imagesy($img);
//create new image and fill with background color
$backgroundImg = @imagecreatetruecolor($width, $height);
imagecopy($backgroundImg, $img, 0, 0, 0, 0, 100, 130);
$color = imagecolorallocatealpha($backgroundImg, 0, 0, 0, 127); //fill transparent back
imagefill($backgroundImg, 0, 0, $color);
//save as png
header("Content-type: image/png");
imagepng($backgroundImg);
imagedestroy($backgroundImg);
?>
很高兴看到您的尝试代码。 IT会澄清你想要做的事情。 –
试图在底部添加两行居中文本。 –
显示我们已经尝试过的代码。 – billynoah