- 積分
- 95
- 金幣
- 7 個(gè)
- 社區(qū)幣
- 0 元
漸入佳境
- 貢獻(xiàn)
- 0 點(diǎn)
- 金幣
- 7 個(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文件
查找
- } elseif($this->param['watermarktype'][$type] == 'text') {
- if(($this->param['watermarktext']['shadowx'][$type] || $this->param['watermarktext']['shadowy'][$type]) && $this->param['watermarktext']['shadowcolor'][$type]) {
- $shadowcolorrgb = explode(',', $this->param['watermarktext']['shadowcolor'][$type]);
- $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
- 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);
- }
- $colorrgb = explode(',', $this->param['watermarktext']['color'][$type]);
- $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
- imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $x + $ax, $y + $ay, $color, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);
- } else {
復(fù)制代碼
替換為:
- } elseif($this->param['watermarktype'][$type] == 'text' && $this->imginfo['width'] >= 250) {
- $objTmpImg = @imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']+16);
- @imagecopy($objTmpImg, $dst_photo, 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);
- $dst_photo = $objTmpImg;
- $bg_x1 = 0;
- $bg_y1 = $this->imginfo['height'];
- $bg_x2 = $this->imginfo['width'];
- $bg_y2 = $this->imginfo['height']+16;
- $shadowcolorrgb = explode(',', $this->param['watermarktext']['shadowcolor'][$type]);
- $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
- imagefilledrectangle($dst_photo, $bg_x1, $bg_y1, $bg_x2, $bg_y2, $shadowcolor);
-
- $colorrgb = explode(',', $this->param['watermarktext']['color'][$type]);
- $n = $_G['member']['username'];
- $w = $_G['setting']['bbname'];
- $u = $_G['setting']['siteurl'];
- preg_match("/^(http:\/\/)?([^\/]+)/i",$u, $ur);
- $url = $ur[2];
- preg_match("/[^\.\/]+\.[^\.\/]+$/", $url, $ur);
- $wtext = "該圖片由網(wǎng)友上傳,版權(quán)歸原創(chuàng)者所有 ".date('Y-m-d h:i')."";
- $watermarktextcvt = $wtext;
- $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
- 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);
- } else {
復(fù)制代碼
我知道答案
回答被采納將會(huì)獲得 1 貢獻(xiàn) 已有0人回答
|
|