Discuz教程网

php GD库制作 图章

[复制链接]
authicon ddd 发表于 2010-9-30 16:36:12 | 显示全部楼层 |阅读模式
代码:
  1. <?php
  2. header("Content-type:image/png");
  3. $img=imagecreatefrompng("s*****p.png");
  4. $bground=imagecolorallocate($img,255,255,255);
  5. $color=imagecolorallocate($img,255,0,0);
  6. $arrStr=array("成","都","蓝","空");
  7. $count=count($arrStr);
  8. $length=intval($count/2);
  9. for($k=0;$k<$count;$k++){
  10. $arrStr[$k]=iconv("gb2312","utf-8",$arrStr[$k]);
  11. }
  12. $font=intval(120/$count);
  13. $count>10 ? $angle=intval(270/$count) : $angle=intval(180/$count);
  14. $xx=intval(170/$count);
  15. $count>10 ? $yy=intval((170*0.35)/$count) : $yy=intval((170*0.5)/$count);

  16. $ii=$length;
  17. for ($i=1;$i<=$length;$i++){
  18. imagettftext($img,$font,$angle,$xx*$i,$yy*$ii*2,$color,"font.ttf",$arrStr[$i-1]);
  19. $ii--;
  20. $angle=90-$angle;
  21. $xx=$xx*$i;
  22. $yy=$yy*$ii;
  23. }
  24. $ii=0 ? $jj=1 :$jj=1;
  25. for ($j=$i;$j<=$length;$j++){
  26. imagettftext($img,$font,$angle,$xx*$j,$yy*$jj*2,$color,"font.ttf",$arrStr[$j]);
  27. $jj++;
  28. $angle=0-$angle;
  29. }

  30. if($count%2==1)
  31. {
  32. imagettftext($img,$font,0,$xx*$i,$yy*$count,$color,"font.ttf",$arrStr[$count/2]);
  33. }

  34. imagepng($img);
  35. imagedestroy($img);
  36. ?>
复制代码




上一篇:很不错PHP+mysql分页
下一篇:强大的Session类
authicon D_hong 发表于 2011-6-27 06:59:37 | 显示全部楼层
不错,我喜欢
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 18:19

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表