最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php使用imagick给图片加水印的方法
时间:2022-06-24 15:10:39 编辑:袖梨 来源:一聚教程网
$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;
?>
相关文章
- 整理拾光全部隐藏物品获取方法攻略 12-04
- 魔理沙还书姬虫百百世彩蛋位置一览 12-04
- 阿西美女室友竟然2第六章全流程攻略 12-04
- 超英派遣中心第四章第一轮班派遣攻略 12-04
- 阿西美女室友竟然2第五章全流程攻略 12-04
- 梦之形跳跳锤维斯珀玩法攻略分享 12-04