最新下载
热门教程
- 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;
?>
相关文章
- 如何用AI制作圆锥效果海报 03-25
- 拷贝漫画如何实现在线漫画下拉式 03-25
- 蚂蚁森林神奇海洋2026年3月24日答案 03-25
- 歪漫科技无删减漫画免费下载最新版本-搜索到的不一定能看在线安装入口 03-25
- Excel打印怎样使每一页都有标题行 03-25
- 千牛网页版客服系统官网链接是什么 03-25