首先声明,这东西不是我做的 只是转载.修改前自行备份文件.由使用此插件所导致的一切后果由个人承担.本人不提供任何支持服务.
效果如下:
附件中提供了修改好的文件,直接上传覆盖\source\class\class_image.php即可.
附修改方法:
打开\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[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
- 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[0], $colorrgb[1], $colorrgb[2]);
- 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[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
- 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 = "魔兽家园 WWW.WAR3DT.COM";
- $watermarktextcvt = iconv('GB2312', 'UTF-8', $wtext);
- $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
- 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 {
复制代码
把代码中的“魔兽家园 WWW.WAR3DT.COM”修改成自己想要的文字。
可用变量,例如“该图片由 $n 于".date('y年n月j日', time())."上传至 本站 版权归原创者所有”
$n为发帖的用户名.
第二步:
上传中文字体到:\static\image\seccode\font\ch 目录。
第三步,后台设置:
水印位置任选。
添加水印条件自定。
水印图片类型选择文字水印。
融合度质量100
文本水印文字,请输入任意内容(必须输入,不然出错)
选择自己上传的字体。
文字大小8-10自己看着办。
水印字体颜色#FFFFFF
水印阴影颜色#000000
已修改的class_image.php下载:
|