目录
Discuz X3.2后台有图片水印功能,当设置了添加水印,在发布文章时候会自动给上传的图片添加上水印,但是一些主题会生成缩略图,缩略图确无法自动添加水印,如何处理?
注:此方法适用于X系列版本,不限于3.2 ,X2.5同样适用。其他版本自测。
解决办法
打开 source\function\function_post.php
这个文件,找到以下代码
$image->Watermark($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], '', 'forum');
在这段代码的上方
加入
// 缩略图打水印
if (file_exists($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid] . '.thumb.jpg')) {
$image->Watermark($_G['setting']['attachdir'] . '/forum/' . $newattachfile[$aid] . '.thumb.jpg', '', 'forum');
}
// 缩略图打水印end
然后继续查找
C::t('forum_attachment_unused')->delete($aid);
在上面这段打开的上方,继续添加
// 缩略图打水印
if (file_exists($_G['setting']['attachdir'] . '/forum/' . $attach['attachment'] . '.thumb.jpg')) {
$image->Watermark($_G['setting']['attachdir'] . '/forum/' . $attach['attachment'] . '.thumb.jpg', '', 'forum');
}
// 缩略图打水印结束
修改后保存或者上传,这样就可以自动为文章的缩略图打上水印了。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。