• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. PHP圖片加水印十分簡單的代碼

        時間:2024-11-05 21:31:32 PHP 我要投稿
        • 相關推薦

        PHP圖片加水印十分簡單的代碼

          PHP圖片加水印十分簡單的代碼

          文字水印:

          復制代碼 代碼如下:

          $w = 80;

          $h = 20;

          $im = imagecreatetruecolor($w,$h);

          $textcolor = imagecolorallocate($im, 123, 12, 255);

          $white = imagecolorallocate($im, 255, 255, 255);

          $grey = imagecolorallocate($im, 128, 128, 128);

          $black = imagecolorallocate($im, 0, 0, 0);

          imagefilledrectangle($im, 0, 0, 399, 29, $grey); //畫一矩形并填充

          // 把字符串寫在圖像左上角

          imagestring($im, 3, 2, 3, "Hello world!", $textcolor);

          // 輸出圖像

          header("Content-type: image/jpeg");

          imagejpeg($im);

          imagedestroy($im);

          圖片水印

          $groundImg = "DSC05940.jpeg";

          $groundInfo = getimagesize($groundImg);

          $ground_w = $groundInfo[0];

          //print_r($groundInfo);

          $ground_h = $groundInfo[1];

          switch($groundInfo[2]){

          case 1:

          $ground_im = imagecreatefromgif($groundImg);

          break;

          case 2:

          $ground_im = imagecreatefromjpeg($groundImg);

          break;

          case 3:

          $ground_im = imagecreatefrompng($groundImg);

          break;

          }

          $waterImg = "DSC05949.jpeg";

          $imgInfo =getimagesize($waterImg);

          $water_w = $imgInfo[0];

          $water_w = $imgInfo[1];

          switch($imgInfo[2]){

          case 1:

          $water_im = imagecreatefromgif($waterImg);

          break;

          case 2:

          $water_im = imagecreatefromjpeg($waterImg);

          break;

          case 3:

          $water_im = imagecreatefrompng($waterImg);

          break;

          }

          imagecopy($ground_im,$water_im,100,100,0,0,500,500);

          header("Content-type: image/jpeg");

          imagejpeg($ground_im);

          合并圖片php提供了很多函數:例如:imagecopymerge,imagecopyresized

        【PHP圖片加水印十分簡單的代碼】相關文章:

        php如何過濾危險html代碼09-21

        將php實現過濾UBB代碼09-11

        php對圖像的各種處理函數代碼總結07-03

        如何在cmd下面寫php代碼01-22

        PHP url 加密解密函數代碼方法10-25

        關于PHP var-dump遍歷對象屬性的函數與應用代碼06-21

        php數組函數序列之array-combine() - 數組合并函數的代碼08-25

        簡單介紹php構造函數用法08-31

        過濾HTML代碼08-29

        關于php面試寶典及PHP面試技巧08-16

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 精品国产经典三级在线看 | 中文字幕人妖一区二区 | 亚洲一区二区三区和欧美四区 | 一本精品99久久精品66 | 午夜在线中文字幕在线播放 | 婷婷五点开心六月综合基地 |