比较好玩的.大家有兴趣的话可以看下
<?
//Header("Content-type: image/jpeg");
set_time_limit(30);
$stime=time();
$str=$_GET[str];
if(strlen($str)>20 or strlen($str)<2)
{
echo "汉字字符长度应在1-10您提交的数据不符合标准";
echo "<META HTTP-EQUIV='Refresh' CONTENT='2;URL=index.php?potourl=$imgfont'>";
exit;
}
if(strlen($str)%2<>0)
{
echo "字符传包含非汉字字符,本程序暂时不支持英文";
echo "<META HTTP-EQUIV='Refresh' CONTENT='2;URL=index.php?potourl=$imgfont'>";
exit;
}
$forno=strlen($str)/2;
$url=$_GET[url];
$str1=$str;
$n=20;
for($i=1;$i<=$forno;$i )
{
$text[$i]=substr($str1,($i-1)*2,2);
$text[$i]=iconv("gb2312","UTF-8",$text[$i]);
$font="font\simsun.ttc";
$ima=imagecreate($n,$n);
$black=ImageColorAllocate($ima, 0,0,0);
$white=ImageColorAllocate($ima, 255,255,255);
ImageTTFText($ima,10,0,4,16,$white,$font,$text[$i]);
//生成图象A
for($d=0,$a=0;$a<$n;$a )
{
for($b=0;$b<$n;$b )
{
$d ;
$rgb=imagecolorat($ima,$b,$a);
//echo $rgb.'<br>';
if($rgb>0)
{
$f=1;
}
else
{
$f=0;
}
$color[$d]=$f;
}
}
//计算点阵
$type=getimagesize($url);
switch ($type)
{
case $type[2]=="1":
$imb=imagecreatefromgif($url);
break;
case $type[2]=="3":
$imb=imagecreatefrompng($url);
break;
default:
$imb=imagecreatefromjpeg($url);
}
$imc=imagecreate(20,20);
imagecopyresized($imc,$imb,0,0,0,0,20,20,$type[0],$type[1]);
$imd[$i]=imagecreate($n*20,$n*20);
$w=ImageColorAllocate($imd[$i], 255,255,255);
imagecolortransparent($imd[$i],$w);
for($z=0;$z<400;$z )
{
if($color[$z]==1)
{
imagecopy($imd[$i],$imc,($z )*20,floor($z/20)*20,0,0,20,20);
}
}
}//全部循环结束
$ime=imagecreate($n*20,$n*20*$forno);
$w=ImageColorAllocate($ime, 255,255,255);
imagecolortransparent($ime,$w);
for($g=1;$g<=$forno;$g )
{
imagecopy($ime,$imd[$g],0,($g-1)*$n*20,0,0,$n*20,$n*20);
}
$time=time();
imagepng($ime,"poto/$time.png");
$imgfont="http://".$_SERVER[SERVER_NAME]."/imgfont/poto/".$time.".png";
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=index.php?potourl=$imgfont'>";
exit;
?>
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




