请选择 进入手机版 | 继续访问电脑版

Discuz!X3.2/X2.5缩略图添加水印方法教程

[复制链接]
查看1984 | 回复0 | 2020-2-16 11:52 | 显示全部楼层 |阅读模式
Discuz X3/X2.5默认开启缩略图的时候水印只添加到原图上面,而缩略图上面无法进行水印图的添加,这里自丢网给dz站长们分享下缩略图添加水印方法。


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. // 缩略图打水印结束
复制代码
修改好后上传覆盖,进入后台更新缓存即可。

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
1
贡献
387
丢币
38902
主题
4607
回帖
116
注册时间
2018-9-25
最后登录
2024-3-30