脚本宝典收集整理的这篇文章主要介绍了使用GD PHP创建具有文本和透明背景的图像,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
header('Content-tyPE: image/png'); $tITle = "test text"; $im = imagecreatetruecolor(87,80); $white = imagecolorallocate($im,255,255); $black = imagecolorallocate($im,0); imagefill($im,87,80,$black); imagecolortransparent($im,$black); $white = imagecolorallocate($im,255); $font = "../fonts/arial.ttf"; $bBox = imagettfbBox(12,-40,"../fonts/arial.ttf",$title); $width = $bBox[2]-$bBox[0]; $height = ceil(($bBox[6]-$bBox[0])/2); $pos = ceil((87-$width)/2); $pOSX = $pos-$height; $posy = $pos+$height; imagettftext($im,12,-45,$posx,$posy,$white,$font,$title); imagepng($im); imagedestroy($im);
以上是脚本宝典为你收集整理的使用GD PHP创建具有文本和透明背景的图像全部内容,希望文章能够帮你解决使用GD PHP创建具有文本和透明背景的图像所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。