欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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)論