php使用imagick给图片加水印的方法
PHP是一种HTML内嵌式的语言,PHP与微软的ASP颇有几分相似,下面我们来看一篇关于php使用imagick给图片加水印的'方法吧,希望这篇文章能够让各位了解到imagick图片加水印的个方法方式。
$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给图片加水印的方法】相关文章:
在上一篇文章中,我们介绍了I
magic
k库的安装;这篇文章我们介绍一下I
magic
k库的基本
使用
;如何给
图片
添
加
渐变
水印
,及
图片
水印
。首先我们要生成一张透明底的画布:// 创建新的画布对象和透明底图像$canvas = new I
magic
k();$canvas->newImage(720, 480, "none");画布生成了,我们就要logo
图片
相关信息,以及设为logo
图片
的位置,宽高...
Imagine a friend of yours approaches you one day and would like you to build her a website so she can showcase her photography. She wants to be able to easily upload her photographs and have them wate...
@版本日期: 版本日期: 2012年1月18日
@著作权所有: 1024 intelligence ( http://www.1024i.com )
获得
使用
本类库的许可, 您必须保留著作权声明信息.
报告漏洞,意见或建议, 请联系 Lou Barnes(iua1024@gmail.com)
class lib_image_i
magic
k {
php
图片
加
水印
,
php
文字
水印
,
php
平铺
水印
,
php
图片
水印
,
php
图片
添
加
图文 平铺
水印
。**
图片
添
加
文字
水印
**```
php
$bigImgPath = '08.jpg';$img = imagecreatefromstring(file_get_contents($bigImgPath));$color = imagecolorallocatealpha($img,255,255,255,...
$bigImgPath = "bgt.jpg"; //原图
$logo = "logo.png"; //
水印
$im = imagecreatefromstring(file_get_contents($bi...
header('Content-Type: text/html; charset=utf-8');
$text = '中粮屯河(sh600737)';//中粮屯河(sh600737)
$watermark = '30598810312...
下面我们来看一篇关于
php
使用
i
magic
k给
图片
加
水印
的
方法
吧,希望这篇文章能够让各位了解到i
magic
k
图片
加
水印
的个
方法
方式。$image = new I
magic
k();$image->readImage("original.jpg");$watermark = new I
magic
k();$watermark->readImage("/data/mark.png");// h...