1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > php 创建透明png php生成透明背景图片实例

php 创建透明png php生成透明背景图片实例

时间:2021-08-20 05:50:56

相关推荐

php 创建透明png php生成透明背景图片实例

例子,php生成背景图片的代码。

复制代码 代码示例:

//透明背景图片

header(‘content-type:text/html;charset=gbk’);

$safess = $_get[safe];

$dir = dirname(__file__).”/simsun.ttc”;

$safe=iconv(“gb2312″,”utf-8″,$safess);

$im=imagecreatetruecolor(160,18);

$color=imagecolorallocate($im,229,231,230);

imagecolortransparent($im,$color); // 设置为透明色,若注释掉该行则输出上面设置的背景

imagefill($im,0,0,$color);

$textcolor=imagecolorallocate($im,0,0,0);

imagettftext($im,9,0,30,12,$textcolor,$dir,$safe);

//imagestring($im,30 , 5, 3, $safe, $textcolor);

header(“content-type:image/png”);

imagegif($im);

?>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。