php画图
原文轉自:http://blog.csdn.net/morewindows/article/details/7274870
在原代碼基礎上稍微修改了下,是不是覺得有點意思
<?php
// by MoreWindows( http://blog.csdn.net/MoreWindows )
$imgWidth = 600;
$imgHeight = 400;
$img = imagecreatetruecolor($imgWidth, $imgHeight);
imagefill($img, 0, 0, imagecolorallocate($img, 240, 240, 240));//設置底色
$snowflake_size = 30;
$font_file = "c:\\WINDOWS\\Fonts\\simhei.ttf";
//生成大雪花 其實就是調用imagettftext()輸出*號
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);
?>
更多請參考:
http://www.php.net/manual/zh/refs.utilspec.image.php總結
- 上一篇: 《梦仙》第三十八句是什么
- 下一篇: 网络协议关系拓扑图 很全面 很好