湖中沉 发表于 2011-4-12 02:56:30

dzX1.5图片底部黑条水印任意文字

首先声明,这东西不是我做的 只是转载.修改前自行备份文件.由使用此插件所导致的一切后果由个人承担.本人不提供任何支持服务.

效果如下:
http://www.discuz.net/data/attachment/forum/201104/03/1433078i3yazc3ekrerxwk.jpg

附修改方法:
打开\source\class目录下class_image.php文件
查找

} elseif($this->param['watermarktype'][$type] == 'text') {

if(($this->param['watermarktext']['shadowx'][$type] || $this->param['watermarktext']['shadowy'][$type]) && $this->param['watermarktext']['shadowcolor'][$type]) {

$shadowcolorrgb = explode(',', $this->param['watermarktext']['shadowcolor'][$type]);

$shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb, $shadowcolorrgb, $shadowcolorrgb);

imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $x + $ax + $this->param['watermarktext']['shadowx'][$type], $y + $ay + $this->param['watermarktext']['shadowy'][$type], $shadowcolor, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);

}



$colorrgb = explode(',', $this->param['watermarktext']['color'][$type]);

$color = imagecolorallocate($dst_photo, $colorrgb, $colorrgb, $colorrgb);

imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $x + $ax, $y + $ay, $color, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);

} else {替换为
} elseif($this->param['watermarktype'][$type] == 'text' && $this->imginfo['width'] >= 250) {

$objTmpImg = @imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']+16);

@imagecopy($objTmpImg, $dst_photo, 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);

$dst_photo = $objTmpImg;

$bg_x1 = 0;

$bg_y1 = $this->imginfo['height'];

$bg_x2 = $this->imginfo['width'];

$bg_y2 = $this->imginfo['height']+16;

$bg_color = imagecolorallocate($dst_photo, 0, 0, 0);

imagefilledrectangle($dst_photo, $bg_x1, $bg_y1, $bg_x2, $bg_y2, $bg_color);

if(($this->param['watermarktext']['shadowx'][$type] || $this->param['watermarktext']['shadowy'][$type]) && $this->param['watermarktext']['shadowcolor'][$type]) {

$shadowcolorrgb = explode(',', $this->param['watermarktext']['shadowcolor'][$type]);

$shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb, $shadowcolorrgb, $shadowcolorrgb);

imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $ax + $this->param['watermarktext']['shadowx'][$type] + 3, $this->imginfo['height'] + $ay + $this->param['watermarktext']['shadowy'][$type] + 2, $shadowcolor, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);

}



$colorrgb = explode(',', $this->param['watermarktext']['color'][$type]);

$n = $_G['member']['username'];

$wtext = "Discuz扩展中心";

$watermarktextcvt = iconv('GB2312', 'UTF-8', $wtext);

$color = imagecolorallocate($dst_photo, $colorrgb, $colorrgb, $colorrgb);

imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $ax + 3, $this->imginfo['height'] + $ay + 1, $color, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);

} else {把代码中的“Discuz扩展中心”修改成自己想要的文字。
可用变量,例如“该图片由 $n 于".date('y年n月j日', time())."上传至 本站 版权归原创者所有”
$n为发帖的用户名.
第二步:
上传中文字体到:\static\image\seccode\font\ch 目录。

第三步,后台设置:
水印位置任选。
添加水印条件自定。
水印图片类型选择文字水印。
融合度质量100
文本水印文字,请输入任意内容(必须输入,不然出错)
选择自己上传的字体。
文字大小8-10自己看着办。
水印字体颜色#FFFFFF
水印阴影颜色#000000



新浪微博评论 发表于 2011-4-12 07:18:37

[给力][害羞]关注我好吗?我有很多有趣的东西给你看[呵呵]的!

http://www.kuozhan.net/xwb/images/bgimg/icon_logo.png 来自 高档食材 的新浪微博

cnya 发表于 2011-4-12 14:04:46

楼主太厉害了!楼主,I*老*虎*U!
Discuz扩展中心 一切皆有可能
页: [1]
查看完整版本: dzX1.5图片底部黑条水印任意文字