找回密码
 注册加入

扫一扫,极速登录

QQ登录

只需一步,快速开始

搜索
查看: 6297|回复: 2

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

[复制链接]
发表于 2011-4-12 02:56:30 | 显示全部楼层 |阅读模式
首先声明,这东西不是我做的 只是转载.修改前自行备份文件.由使用此插件所导致的一切后果由个人承担.本人不提供任何支持服务.

效果如下:

                               
登录/注册后可看大图


附修改方法:
打开\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 = "Discuz扩展中心";

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

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



发表于 2011-4-12 07:18:37 | 显示全部楼层
[给力][害羞]关注我好吗?我有很多有趣的东西给你看[呵呵]的!


                               
登录/注册后可看大图
来自 高档食材 的新浪微博
回复 支持 反对

使用道具 举报

发表于 2011-4-12 14:04:46 | 显示全部楼层
楼主太厉害了!楼主,I*老*虎*U!
Discuz扩展中心 一切皆有可能
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册加入  

本版积分规则

Archiver|手机版|小黑屋|Discuz!扩展中心 ( 浙ICP备14042422号-1 )|网站地图QQ机器人

GMT+8, 2024-4-29 19:57 , Processed in 0.202704 second(s), 15 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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