|
后臺設置文本水印文字時,雖然可以任意輸入,但不要輸英文或數字字符,輸一個中文,就可以了。
后臺設置:
啟用水印功能。
水印位置任選。
添加水印條件自定。
水印圖片類型選擇文字水印。
融合度質量100(其實多少都沒影響)。
文本水印文字,請輸入任意內容(一定要輸,不然出錯)
選擇自己上傳的字體。
文字大小8-10自己看著辦。
文本水印顯示角度:0
水印字體顏色【自己測試效果】
水印陰影顏色【自己測試效果】
其它無視了,提交測試吧。
修改方法:
打開\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 {
復制代碼
替換為:
- } 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 = "該圖片由網友上傳,版權歸原創者所有 ".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 {
復制代碼
我知道答案
回答被采納將會獲得 1 貢獻 已有0人回答
|
|