php使用imagick給圖片加水印的方法

    時間:2024-10-23 09:02:52 PHP 我要投稿
    • 相關推薦

    php使用imagick給圖片加水印的方法

      PHP是一種HTML內嵌式的語言,PHP與微軟的ASP頗有幾分相似,下面我們來看一篇關于php使用imagick給圖片加水印的方法吧,希望這篇文章能夠讓各位了解到imagick圖片加水印的個方法方式。

      <?php

      $image = new Imagick();

      $image->readImage("original.jpg");

      $watermark = new Imagick();

      $watermark->readImage("/data/mark.png");

      // how big are the images?

      $iWidth = $image->getImageWidth();

      $iHeight = $image->getImageHeight();

      $wWidth = $watermark->getImageWidth();

      $wHeight = $watermark->getImageHeight();

      if ($iHeight < $wHeight || $iWidth < $wWidth) {

      // resize the watermark

      $watermark->scaleImage($iWidth, $iHeight);

      // get new size

      $wWidth = $watermark->getImageWidth();

      $wHeight = $watermark->getImageHeight();

      }

      // calculate the position

      $x = ($iWidth – $wWidth);

      $y = ($iHeight – $wHeight);

      $image->compositeImage($watermark, imagick::COMPOSITE_OVER, $x, $y);

      header("Content-Type: image/" . $image->getImageFormat());

      echo $image;

      ?>

    【php使用imagick給圖片加水印的方法】相關文章:

    php在新浪云中使用imagick的方法07-14

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

    PHP imagick API中文簡介09-01

    PHP中使用curl方法介紹09-17

    PHP使用方法之phpize06-20

    php引用函數的使用方法10-09

    php的obFlush與Flush使用方法11-02

    PHP中strtotime函數使用方法10-08

    PHP 透明水印生成代碼參考05-31

    如何使用PHP計算時間差的方法08-21

    91久久大香伊蕉在人线_国产综合色产在线观看_欧美亚洲人成网站在线观看_亚洲第一无码精品立川理惠

      色多多视频网址在线观看 | 日韩精品一区二区三区69 | 最新69国产精品视频 | 在线中文字幕乱码免费网站 | 亚洲一区色77综合影院 | 亚洲成α人片在线观看 |