最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php畫圖實(shí)例

 更新時(shí)間:2014年11月05日 16:02:40   投稿:shichen2014  
這篇文章主要介紹了php畫圖的方法,實(shí)例講述了基于PHP繪制圖像與文字的方法,需要的朋友可以參考下

本文實(shí)例講述了php畫圖的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:
<?php 
// by MoreWindows
$imgWidth = 600; 
$imgHeight = 400; 
$img = imagecreatetruecolor($imgWidth, $imgHeight); 
imagefill($img, 0, 0, imagecolorallocate($img, 240, 240, 240));//設(shè)置底色 
$snowflake_size = 30; 
$font_file = "c:\\WINDOWS\\Fonts\\simhei.ttf";  
//生成大雪花 其實(shí)就是調(diào)用imagettftext()輸出*號(hào) 
for ($i=1; $i<=400; $i++)  

    $font_color = imagecolorallocate($img, mt_rand(100,200), mt_rand(100,200), mt_rand(100,200)); 
    imagettftext($img, $snowflake_size, mt_rand(0, 180), mt_rand(0, $imgWidth),mt_rand(0, $imgHeight), $font_color, $font_file, "□");  

//水印文字 
$black_color = imagecolorallocate($img, 0, 0, 0); 
imagettftext($img, 12, 0, $imgWidth - 50 , $imgHeight - 20, $black_color, $font_file, "PHP畫圖"); 
imagepng($img); 
imagedestroy($img); 
?>

本實(shí)例運(yùn)行效果如下圖所示

更多請(qǐng)參考:
http://www.php.net/manual/zh/refs.utilspec.image.php

希望本文所述對(duì)大家的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

无极县| 江陵县| 吴忠市| 桐乡市| 应用必备| 奉贤区| 江西省| 凌海市| 玛曲县| 浦县| 沧州市| 石门县| 兴和县| 浏阳市| 巴中市| 平原县| 句容市| 宿州市| 余江县| 克拉玛依市| 定南县| 甘孜| 日土县| 无锡市| 绥滨县| 斗六市| 梁平县| 清丰县| 阿拉善盟| 远安县| 连州市| 青神县| 陕西省| 江津市| 沧源| 阿克苏市| 平湖市| 淳安县| 邛崃市| 和平区| 饶阳县|