Discuz!X2图片底部黑条水印任意文字,并与图片水印共存
效果如上图,底部水印+图片水印修改方法:source\class\class_image.php
搜索imageCopy($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h);下边添加//@dly start global $_G;//自定义(开png水印时无法获取文字水印的参数,所以自定义)$this->param['watermarktext']['fontpath'][$type] = 'static/image/seccode/font/ch/msyh.ttf';$this->param['watermarktext']['size'][$type] = 9;$this->param['watermarktext']['color'][$type] = '255,255,255';$this->param['watermarktext']['shadowcolor'][$type] = '';$username = $_G['username'];$bbname = $_G['setting']['bbname'];$siteurl = $_G['setting']['siteurl'];if($this->imginfo['width'] >= 260 && $this->imginfo['width'] <= 324) { $wtext = "该图片由 $username 上传至 $bbname ";}elseif ($this->imginfo['width'] >= 325 && $this->imginfo['width'] <= 425) { $wtext = "该图片由 $username 上传至 $bbname $siteurl";}elseif ($this->imginfo['width'] >= 426&& $this->imginfo['width'] <= 585) { $wtext = "该图片由 $username 上传至 $bbname $siteurl 版权归原创者所有";}elseif ($this->imginfo['width'] >= 586) { $wtext = "该图片于 ".date('Y-m-d G:i:s')." 由 $username 上传至 $bbname($siteurl) 版权归原创者所有";}$watermarktextcvt = iconv('GB2312', 'UTF-8', $wtext);if(!function_exists('imagettfbbox') || !function_exists('imagettftext') || !function_exists('imagecolorallocate')) { return -4;}if(!class_exists('Chinese')) { include libfile('class/chinese');}//$watermarktextcvt = pack("H*", $this->param['watermarktext']['text'][$type]);$box = imagettfbbox($this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);$logo_h = max($box, $box) - min($box, $box);$logo_w = max($box, $box) - min($box, $box);$ax = min($box, $box) * -1;$ay = min($box, $box) * -1;
Discuz教程网(www.discuz.1314study.com)原创内容,转载注明出处
代码中的$this->param['watermarktext']['fontpath'][$type] = 'static/image/seccode/font/ch/msyh.ttf'; $this->param['watermarktext']['size'][$type] = 9; $this->param['watermarktext']['color'][$type] = '255,255,255';分别对应字体、大小、RGB颜色
底部黑条水印在下载远程图片时会出现重复添加水印的问题 进来学习一下。 正想要呢,看看下 X3的能用吗? 进来学习一下,不知道x3.2能不能用 Discuz!X2图片底部黑条水印任意文字 85方法反反复复 总想着对方斯蒂芬斯蒂芬 如果您要查看本帖隐藏内容请回复 不错的样子
页:
[1]