亚洲精品中文字幕无乱码_久久亚洲精品无码AV大片_最新国产免费Av网址_国产精品3级片

PHP

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

時(shí)間:2024-07-03 09:12:56 PHP 我要投稿
  • 相關(guān)推薦

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

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

  <?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給圖片加水印的方法】相關(guān)文章:

word中添加文字水印和圖片水印的方法10-12

PHP圖片加水印十分簡(jiǎn)單的代碼07-17

PHP imagick API中文簡(jiǎn)介09-12

php引用函數(shù)的使用方法09-18

php的obFlush與Flush使用方法06-17

PHP使用方法之phpize07-18

PHP中使用curl方法介紹07-31

PHP中strtotime函數(shù)使用方法10-07

PHP 透明水印生成代碼參考08-29

使用PHP開發(fā)高效的WEB系統(tǒng)的方法介紹09-28