我已经添加了PHP水印动画图像,但我面临的问题是,orginal.gif图像创建后不是动画水印。
代码:
<?php
$image = new Imagick();
$image->readImage("orginal.gif");
$watermark = new Imagick();
$watermark->readImage("watermark.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) / 2;
$y = ($iHeight - $wHeight) / 2;
$image->compositeImage($watermark, imagick::COMPOSITE_OVER, $x, $y);
header("Content-Type: image/" . $image->getImageFormat());
echo $image;
?>orginal.gif

watermark.png

输出:

Description:本人有一个表单有上传文件的选项,上传文件只接受gif图像上传后的gif图像,gif图像将在站点中显示带有徽标水印。但在给出水印图像时,水印GIF图像并不是动画的。
发布于 2014-03-27 07:27:31
你可以试试这个:
//use imagemagick command-line
passthru("convert -coalesce orginal.gif -gravity SouthEast -draw 'Image Over 10,10,0,0 $watermark.png' Output.gif");https://stackoverflow.com/questions/21554611
复制相似问题