php利用imagick给图片加水印的方法
发布时间:2023-09-19 10:43:58 所属栏目:PHP教程 来源:
导读:php使用imagick给图片加水印的方法
<?php
$image = new Imagick();
$image->readImage("original.jpg");
$watermark = new Imagick();
$watermark->readImage("/data/mark.png");
// how big are
<?php
$image = new Imagick();
$image->readImage("original.jpg");
$watermark = new Imagick();
$watermark->readImage("/data/mark.png");
// how big are
php使用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); //Cuoxin.com $image->compositeImage($watermark, imagick::COMPOSITE_OVER, $x, $y); header("Content-Type: image/" . $image->getImageFormat()); echo $image; ?> (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐