久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發(fā)帖
查看: 845|回復(fù): 0

[雜談] 小黑條文字水印,不破壞原圖,后臺(tái)控制文字及背景顏色,更新帶日期版本

25

主題

57

回帖

95

積分

漸入佳境

貢獻(xiàn)
0 點(diǎn)
金幣
7 個(gè)
樓主
發(fā)表于 2023-3-17 04:46:31 | 只看樓主 |倒序?yàn)g覽 |閱讀模式
后臺(tái)設(shè)置文本水印文字時(shí),雖然可以任意輸入,但不要輸英文或數(shù)字字符,輸一個(gè)中文,就可以了。



后臺(tái)設(shè)置:
啟用水印功能。
水印位置任選。
添加水印條件自定。
水印圖片類型選擇文字水印。
融合度質(zhì)量100(其實(shí)多少都沒(méi)影響)。
文本水印文字,請(qǐng)輸入任意內(nèi)容(一定要輸,不然出錯(cuò))
選擇自己上傳的字體。
文字大小8-10自己看著辦。
文本水印顯示角度:0
水印字體顏色【自己測(cè)試效果】
水印陰影顏色【自己測(cè)試效果】
其它無(wú)視了,提交測(cè)試吧。



修改方法:
打開(kāi)\source\class目錄下class_image.php文件
查找

  1. } elseif($this->param['watermarktype'][$type] == 'text') {
  2.                                 if(($this->param['watermarktext']['shadowx'][$type] || $this->param['watermarktext']['shadowy'][$type]) && $this->param['watermarktext']['shadowcolor'][$type]) {
  3.                                         $shadowcolorrgb = explode(',', $this->param['watermarktext']['shadowcolor'][$type]);
  4.                                         $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
  5.                                         imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $x + $ax + $this->param['watermarktext']['shadowx'][$type], $y + $ay + $this->param['watermarktext']['shadowy'][$type], $shadowcolor, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);
  6.                                 }

  7.                                 $colorrgb = explode(',', $this->param['watermarktext']['color'][$type]);
  8.                                 $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
  9.                                 imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $x + $ax, $y + $ay, $color, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);
  10.                         } else {
復(fù)制代碼


替換為:


  1. } elseif($this->param['watermarktype'][$type] == 'text' && $this->imginfo['width'] >= 250) {
  2.         $objTmpImg = @imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']+16);
  3.         @imagecopy($objTmpImg, $dst_photo, 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);
  4.         $dst_photo = $objTmpImg;
  5.         $bg_x1 = 0;
  6.         $bg_y1 = $this->imginfo['height'];
  7.         $bg_x2 = $this->imginfo['width'];
  8.         $bg_y2 = $this->imginfo['height']+16;
  9.                 $shadowcolorrgb = explode(',', $this->param['watermarktext']['shadowcolor'][$type]);
  10.         $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
  11.         imagefilledrectangle($dst_photo, $bg_x1, $bg_y1, $bg_x2, $bg_y2, $shadowcolor);
  12.                           

  13.         $colorrgb = explode(',', $this->param['watermarktext']['color'][$type]);
  14.         $n = $_G['member']['username'];
  15.                 $w = $_G['setting']['bbname'];
  16.                 $u = $_G['setting']['siteurl'];
  17.                 preg_match("/^(http:\/\/)?([^\/]+)/i",$u, $ur);
  18.                 $url = $ur[2];
  19.                 preg_match("/[^\.\/]+\.[^\.\/]+$/", $url, $ur);
  20.                 $wtext = "該圖片由網(wǎng)友上傳,版權(quán)歸原創(chuàng)者所有 ".date('Y-m-d h:i')."";
  21.         $watermarktextcvt = $wtext;
  22.         $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
  23.         imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $ax + 3, $this->imginfo['height'] + $ay + 1, $color, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);
  24.                         } else {
復(fù)制代碼




我知道答案 回答被采納將會(huì)獲得1 貢獻(xiàn) 已有0人回答
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

  • 關(guān)注公眾號(hào)
  • 有償服務(wù)微信
  • 有償服務(wù)QQ

手機(jī)版|小黑屋|Discuz! 官方交流社區(qū) ( 皖I(lǐng)CP備16010102號(hào) |皖公網(wǎng)安備34010302002376號(hào) )|網(wǎng)站地圖|star

GMT+8, 2025-7-2 01:57 , Processed in 0.048980 second(s), 12 queries , Redis On.

Powered by Discuz! W1.0 Licensed

Cpoyright © 2001-2025 Discuz! Team.

關(guān)燈 在本版發(fā)帖
有償服務(wù)QQ
有償服務(wù)微信
返回頂部
快速回復(fù) 返回頂部 返回列表