亚欧洲精品在线观看,窝窝影院午夜看片,久久国产成人午夜av影院宅,午夜91,免费国产人成网站,ts在线视频,欧美激情在线一区

php語(yǔ)言

php畫圖實(shí)例

時(shí)間:2025-03-19 22:07:31 php語(yǔ)言 我要投稿

php畫圖實(shí)例

  本文實(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:WINDOWSFontssimhei.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)行效果如下圖所示

  php畫圖實(shí)例1

  更多請(qǐng)參考:

  http://www.php.net/manual/zh/refs.utilspec.image.php

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

【php畫圖實(shí)例】相關(guān)文章:

PHP使用JPG生成GIF動(dòng)畫圖片實(shí)例06-24

php查詢mysql的實(shí)例04-03

PHP socket的配置及實(shí)例03-21

PHP實(shí)用的代碼實(shí)例08-12

php中fsockopen用法實(shí)例06-20

php防盜鏈實(shí)例05-18

學(xué)習(xí)php分頁(yè)代碼實(shí)例05-20

php簡(jiǎn)單偽靜態(tài)實(shí)例03-07

PHP中常用的實(shí)例介紹04-15