萝卜头IT论坛

搜索
查看: 2671|回复: 0
收起左侧

[Discuz!] Discuz! X3/X2.5缩略图添加水印方法

[复制链接]
发表于 2013-6-23 19:21:01 | 显示全部楼层 |阅读模式

Discuz X3/X2.5默认开启缩略图的时候水印只添加到原图上面,而缩略图上面无法进行水印图的添加,今天在站帮网说下缩略图添加水印方法。

1、打开source\function\function_post.php

2、查找

  1. $image->Watermark($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], '', 'forum');
复制代码

在其代码上面添加

  1. // 缩略图打水印
  2.          if (file_exists($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid] . '.thumb.jpg')) {
  3.                     $image->Watermark($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid] . '.thumb.jpg', '', 'forum');
  4.                 }
  5.                 // 缩略图打水印end
复制代码

3、查找

  1. C::t('forum_attachment_unused')->delete($aid);
复制代码

在其代码上面添加

  1. // 缩略图打水印
  2.        if (file_exists($_G['setting']['attachdir'] . '/forum/' . $attach['attachment'] . '.thumb.jpg')) {
  3.                 $image->Watermark($_G['setting']['attachdir'] . '/forum/' . $attach['attachment'] . '.thumb.jpg', '', 'forum');
  4.             }
  5.             // 缩略图打水印结束
复制代码

修改好后上传覆盖即可。


回复

使用道具 举报

联系我们(Contact)|手机版|萝卜头IT论坛 ( 苏ICP备15050961号-1 )

GMT+8, 2024-4-23 14:49 , Processed in 0.112799 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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