[英]How to add on my image gif's watermark with php?
I try this: 我试试这个:
$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;
but this don't working, the images is curdle. 但这不起作用,图像是凝固的。
And try this: 试试这个:
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);
This code does not work I do not know why it does not. 这段代码不起作用我不知道为什么不行。 We wish you a directory where there Gif htaccess can do it in gifs watermarking
我们希望你有一个目录,Gif htaccess可以在GIFs水印中做到这一点
This class could be your solution: 这个类可能是你的解决方案:
PHP Classes transparent watermark PHP类透明水印
Take a look at the link below. 请看下面的链接。 I have done the same thing in php.
我在php中做了同样的事情。 I hope that this will helps you.
我希望这会对你有所帮助。 https://dl.dropboxusercontent.com/u/58146160/watermark%20image.rar
https://dl.dropboxusercontent.com/u/58146160/watermark%20image.rar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.