php绘图技术入门简介

WBOY
풀어 주다: 2016-07-25 08:52:08
원래의
1079명이 탐색했습니다.
  1. //绘图技术 基本步骤 前提:在php.ini文件中启用gd库

  2. //创建画布 默认背景是黑色的
  3. $img=imagecreatetruecolor(400,300);
  4. //绘制各种图形
  5. //创建一个颜色
  6. $background = imagecolorallocate($img, 255, 0, 0);
  7. //画圆
  8. //imageellipse($img,30,30,50,50,$background);
  9. //椭圆
  10. //imageellipse($img,30,30,50,30,$background);
  11. //画直线
  12. //imageline($img,0,0,400,300,$background);
  13. //画矩形
  14. //imagerectangle ($img, 50 , 20 , 100 , 40 , $background);
  15. //填充矩形
  16. //imagefilledrectangle ($img, 50 , 20 , 100 , 40 , $background);
  17. //画弧线
  18. //imagearc($img, 100, 100, 150, 150, 180, 270, $background);
  19. //画扇型 IMG_ARC_CHORD直线连接了起始和结束点 IMG_ARC_PIE
  20. //imagefilledarc($img, 100, 100, 150, 150, 180, 270, $background,IMG_ARC_PIE);
  21. //拷贝图片到画布

  22. /*$scrImg=imagecreatefromgif('http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif');
  23. $scrImgInfo=getimagesize('http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif');
  24. imagecopy ($img,$scrImg,10,10,0,0,$scrImgInfo[0],$scrImgInfo[1]);
  25. */
  26. //imagecopy ($img,$scrImg,10,10,0,0,270,129);
  27. //写字

  28. //imagestring ($img , 5 , 20 , 20 , "hello,world", $background );
  29. //写中文
  30. $str="PHP绘画技术";
  31. imagettftext ($img , 30 , 0 , 50 ,50, $background , "MSYHBD.TTF" , $str);
  32. //输出图像到网页(或者另存为)
  33. header("content-type: image/png");
  34. imagepng($img);
  35. //销毁该图片(释放内存)
  36. imagedestroy($img);
  37. ?>
复制代码


관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!