[高分求]:php中如何让文本生成图形? 这个简单,用GD的函数。我想问一下,如何实现中文PNG图片呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?phpHeader("Content-type: image/PNG"); $myip="127.0.0.1";$im = imagecreate(100,20); $bkg = ImageColorAllocate($im, 220,220,220); for ($i = 0; $i < strlen($myip); $i++) { imagestring($im, 5, $i*10+10, 0, substr($myip,$i,1), ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255)));}ImagePNG($im); ImageDestroy($im); ?> <?phpHeader("Content-type: image/PNG"); $im = imagecreate(400,50); $bkg = ImageColorAllocate($im, 128,64,225); $clr = ImageColorAllocate($im, 255,255,255); $fnt = "c:\winnt\fonts\simsun.ttc";//linux下改成linux下的字库路径$str = iconv("GB2312","UTF-8","欢迎光临"); ImageTTFText($im, 20, 0, 230,40, $clr, $fnt, $str); $black = ImageColorAllocate($im, 0,0,0);$white = ImageColorAllocate($im, 255,255,255);imageline($im, 1, 1, 350, 25, $black);imagearc($im, 200, 15, 20, 20, 35, 190, $white);imagestring($im, 5, 4, 10, "Graph TEST!!", $white);ImagePNG($im); ImageDestroy($im); ?> to唯她能讲讲这一部分的意思吗?for ($i = 0; $i < strlen($myip); $i++) { imagestring($im, 5, $i*10+10, 0, substr($myip,$i,1), ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255)));} 还有就是如何让文本按一定的格式生成图片?比如我想生成这样的图形,应如何实现?解出来再加50。 127.0.0.1-------------Made in China for ($i = 0; $i < strlen($myip); $i++) { imagestring($im, 5, $i*10+10, 0, substr($myip,$i,1), ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255)));}:将字串"127.0.0.1"一个字个字的分别以不同的随机色画出.imagestring(资源变量,大小,左距,顶距,字符串变量,颜色值).rand(5, 255)产生5-255之间的数值. <?phpHeader("Content-type: image/PNG"); $myip="127.0.0.1";$im = imagecreate(100,35); $bkg = imagecolorallocatealpha($im, 220,220,220,0.6 ); //背景色$red = imagecolorallocatealpha($im, 220,0,0,0.6 ); //红色$blue = imagecolorallocate($im, 0,0,220 ); //蓝色for ($i = 0; $i < strlen($myip); $i++) { imagestring($im, 5, $i*10+5, 0, substr($myip,$i,1), $blue);//ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255))改成这样就成了随机色}imagestring($im,5,5,10,"----------",$red);imagestring($im,3,5,20,"Made in China",$red);ImagePNG($im); ImageDestroy($im); ?> to 惟她$str = iconv( "GB2312 ", "UTF-8 ", "欢迎光临 "); 这个程序提示未定义的函数,不知什么问题,先结账吧,能不能把这个解决后的发到我的留言 用file_get_contents获取字符串问题 output_buffering = Off时怎么使用session? 关于json中有\的问题 mysql表中一字段不含有某个值的问题,在线等 求助,安装php时,加载mysql失败 急!!!请大家帮忙看一段程序! 数据库连接类的问题 如何设置,实现Linux系统下使用php中的函数mail()能成功发送邮件? 请教cookie的问题! php 字符串长度限制 CSDN上左边的大类和小类,可以利用PHP动态管理吗?求这样一份代码或思路 关于PHP系统常量的一个非常好笑的问题!!
Header("Content-type: image/PNG"); $myip="127.0.0.1";$im = imagecreate(100,20);
$bkg = ImageColorAllocate($im, 220,220,220); for ($i = 0; $i < strlen($myip); $i++) {
imagestring($im, 5, $i*10+10, 0, substr($myip,$i,1), ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255)));
}ImagePNG($im);
ImageDestroy($im); ?>
Header("Content-type: image/PNG"); $im = imagecreate(400,50);
$bkg = ImageColorAllocate($im, 128,64,225);
$clr = ImageColorAllocate($im, 255,255,255); $fnt = "c:\winnt\fonts\simsun.ttc";//linux下改成linux下的字库路径
$str = iconv("GB2312","UTF-8","欢迎光临");
ImageTTFText($im, 20, 0, 230,40, $clr, $fnt, $str); $black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
imageline($im, 1, 1, 350, 25, $black);
imagearc($im, 200, 15, 20, 20, 35, 190, $white);
imagestring($im, 5, 4, 10, "Graph TEST!!", $white);ImagePNG($im);
ImageDestroy($im); ?>
能讲讲这一部分的意思吗?
for ($i = 0; $i < strlen($myip); $i++) {
imagestring($im, 5, $i*10+10, 0, substr($myip,$i,1), ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255)));
}
比如我想生成这样的图形,应如何实现?解出来再加50。 127.0.0.1
-------------
Made in China
imagestring($im, 5, $i*10+10, 0, substr($myip,$i,1), ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255)));
}
:将字串"127.0.0.1"一个字个字的分别以不同的随机色画出.
imagestring(资源变量,大小,左距,顶距,字符串变量,颜色值).
rand(5, 255)产生5-255之间的数值.
Header("Content-type: image/PNG"); $myip="127.0.0.1";$im = imagecreate(100,35);
$bkg = imagecolorallocatealpha($im, 220,220,220,0.6 ); //背景色
$red = imagecolorallocatealpha($im, 220,0,0,0.6 ); //红色
$blue = imagecolorallocate($im, 0,0,220 ); //蓝色
for ($i = 0; $i < strlen($myip); $i++) {
imagestring($im, 5, $i*10+5, 0, substr($myip,$i,1), $blue);//ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255))改成这样就成了随机色
}
imagestring($im,5,5,10,"----------",$red);
imagestring($im,3,5,20,"Made in China",$red);ImagePNG($im);
ImageDestroy($im); ?>