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.             // 縮略圖打水印結束

修改好後上傳覆蓋即可。