- //透明背景图片
- 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);
- ?>
复制代码 |