0

我试试这个:

$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
$image = imagecreatefromstring(file_get_contents($path));

$w = imagesx($image);
$h = imagesy($image);

$centerX=round($w/4);
$centerY=round($h/2);

$watermark = imagecreatefrompng('lool-face.png');
$ww = imagesx($watermark);
$wh = imagesy($watermark);

imagecopy($image, $watermark, $centerX, $centerY, 0, 0, $ww, $wh);

eregi('\.(gif|jpeg|jpg|png)$',$path,$regs);
switch( $regs[1] ) {
case 'gif':
   header('Content-type: image/gif');
   imagegif($image);
   break;

但这不起作用,图像是凝固的。

试试这个:

shell_exec('for i in sphere*.gif; do convert $i  -font Arial -pointsize 20 \
    -draw "gravity south \
    fill black  text 0,12 \'Copyright\' \
    fill white  text 1,11 \'Copyright\' " \
    wmark_$i; done');

shell_exec("convert   -delay 20   -loop 0   wmark_sphere*.gif   animatespheres.gif");
$f = fopen("animatespheres.gif", 'rb');
fpassthru($f);
fclose($f);

这段代码不起作用我不知道为什么它不起作用。我们希望你有一个目录,那里有 Gif htaccess 可以在 gifs 水印中做到这一点

4

2 回答 2

1

此类可能是您的解决方案:
PHP Classes transparent watermark

于 2013-08-13T14:15:33.140 回答
1

看看下面的链接。我在php中做了同样的事情。我希望这会对你有所帮助。 https://dl.dropboxusercontent.com/u/58146160/watermark%20image.rar

于 2013-08-13T14:36:30.607 回答