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

修改好後上傳覆蓋即可。