<?php
header("Content-type: image/gif");
//设置画布
$im =imagecreate(200,300);
// 背景设为红色
$background_color = ImageColorAllocate ($im, 255, 255, 255);
// 设置字体颜色为黑色
$col = imagecolorallocate($im, 0, 0, 0);
//字体所放目录
$font="./simhei.ttf";
//写 TTF 文字到图中 字体向图像写入文本 第一个是画布 第二个是字体尺寸 第三个是角度 第四个是x 第五个是y
imagettftext($im,10,0,80,150,$col,$font,"武汉大学");
imagegif($im,'new.gif');
imagedestroy($im);
header("Content-type: image/gif");
//设置画布
$im =imagecreate(200,300);
// 背景设为红色
$background_color = ImageColorAllocate ($im, 255, 255, 255);
// 设置字体颜色为黑色
$col = imagecolorallocate($im, 0, 0, 0);
//字体所放目录
$font="./simhei.ttf";
//写 TTF 文字到图中 字体向图像写入文本 第一个是画布 第二个是字体尺寸 第三个是角度 第四个是x 第五个是y
imagettftext($im,10,0,80,150,$col,$font,"武汉大学");
imagegif($im,'new.gif');
imagedestroy($im);