Discuz教程网

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

  [复制链接]
authicon dly 发表于 2011-4-9 10:10:14 | 显示全部楼层 |阅读模式
插件作者: unknown 无法下载,请举报
插件编码: GBK简体 UTF8简体 BIG5繁体 UTF8繁体 
适用版本: Discuz! X1.5 
支持站点: unknown
作品介绍: 在图片底部增加一黑条水印
修改前自行备份文件



修改前自行备份文件

附件中提供了修改好的文件,直接上传覆盖\source\class\class_image.php即可.
附修改方法:
打开\source\class目录下class_image.php文件
查找

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

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

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

  4. $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);

  5. 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);

  6. }



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

  8. $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);

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

  10. } else {
复制代码

替换为:

  1. } elseif($this->param['watermarktype'][$type] == 'text' && $this->imginfo['width'] >= 250) {

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

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

  4. $dst_photo = $objTmpImg;

  5. $bg_x1 = 0;

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

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

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

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

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

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

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

  13. $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);

  14. 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);

  15. }



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

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

  18. $wtext = "魔兽家园 WWW.WAR3DT.COM";

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

  20. $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);

  21. 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);

  22. } else {
复制代码

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

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

已修改的class_image.php下载
附件下载:
游客,如果您要查看本帖隐藏内容请回复




上一篇:Discuz X1.5 底部美化,附懒人图片包,直接覆盖即可!
下一篇:Discuz X2.0微博登录插件 iConnect X2【0404版】支持腾讯、新浪、网易微博绑定登录
authicon qyhack 发表于 2011-4-10 03:46:16 | 显示全部楼层
很好很强大
authicon 9080508 发表于 2011-4-10 14:11:20 | 显示全部楼层
太好了,正需要这个呢
authicon ken 发表于 2011-4-10 14:14:37 | 显示全部楼层
额这个是什么
authicon huiaiqi14 发表于 2011-4-11 18:32:31 | 显示全部楼层
添加收藏 设为首页 运行时间
authicon 聚聚小屋 发表于 2011-4-13 18:16:06 | 显示全部楼层
测试了别处的出现乱码  希望这个行得通吧
authicon 聚聚小屋 发表于 2011-4-13 19:42:07 | 显示全部楼层
回复 聚聚小屋 的帖子

还是一样出现错误。没辙,自己动手编辑了尝试数十次,发现原来是少了红色那个s字 ['members']
authicon 歪曲事实 发表于 2011-4-18 11:43:39 | 显示全部楼层
authicon test 发表于 2011-4-20 00:06:17 | 显示全部楼层
不错看看
authicon 281023 发表于 2011-4-20 02:02:54 | 显示全部楼层
i好大方好 多福多寿
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 07:16

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表