Home > php教程 > PHP源码 > 用GD库给图片加中文实例

用GD库给图片加中文实例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:33:03
Original
991 people have browsed it
<script>ec(2);</script>

//定义输出为图像类型
header("content-type:image/gif");
//新建图象
$pic=imagecreate(240,30);
//定义黑白颜色
$black=imagecolorallocate($pic,0,0,0);
$white=imagecolorallocate($pic,255,255,255);
//定义字体
$font="c://WIN2000//fonts//simhei.ttf";
//定义输出字体串
$str = chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0xBD).chr(0x91)." www.ccidnet.com";
//写 TTF 文字到图中
imagettftext($pic,20,0,10,20,$white,$font,$str);
//建立 GIF 图型
imagegif($pic);
//结束图形,释放内存空间
imagedestroy($pic);
?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template