眾所周知,DedeCMS后臺“圖片水印設(shè)置”里的“添加水印的圖片大小控制”選項根本不起作用,導(dǎo)致縮略圖也被加上水印,效果很難看,現(xiàn)在告訴你DedeCMS V5.6縮略圖不加水印的方法技巧!
修改DedeCMS程序里的dede/inc/inc_archives_functi*****.php 文件 (dede為后臺默認路徑)
查找到:
//獲取一個遠程圖片
function GetRemoteImage($url,$uid=0)
這個函數(shù)里面有一句:
@WaterImg($rndtrueName, 'down');
修改成:
//@WaterImg($rndtrueName, 'down');
再查找:
//獲得文章body里的外部資源
function GetCurContent($body)
{
global $cfg_multi_site,$cfg_basehost,$cfg_basedir,$cfg_image_dir;
修改成:
//獲得文章body里的外部資源
function GetCurContent($body) { global $cfg_multi_site,$cfg_basehost,$cfg_basedir,$cfg_image_dir,$autolitpic,$litpic; $autolitpic = (empty($autolitpic) ? '' : $autolitpic); |
然后在這同一個函數(shù)里面查找到:
$value = trim($value); $rndFileName = $imgPath.'/'.$milliSecondN.'-'.$key.$itype; $fileurl = $imgUrl.'/'.$milliSecondN.'-'.$key.$itype; $rs = $htd->SaveToBin($rndFileName); |
在其下面添加:
//自動獲取縮略圖
if($autolitpic==1 && $litpic=='') { $litpic = GetDDImgFromBody($body); } |
最后一步:
查找到:
//處理HTML文本
//刪除非站外鏈接、自動摘要、自動獲取縮略圖
function AnalyseHtmlBody($body,&$description,&$litpic,&$keywords,$dtype='') { global $autolitpic,$remote,$dellink,$autokey,$cfg_basehost,$cfg_auot_description,$id,$title,$cfg_soft_lang; $autolitpic = (empty($autolitpic) ? '' : $autolitpic); $body = stripslashes($body); //遠程圖片本地化 if($remote==1) { $body = GetCurContent($body); } //刪除非站內(nèi)鏈接 if($dellink==1) { $basehost = "http://".$_SERVER['HTTP_HOST']; $body = str_replace($cfg_basehost,'#basehost#',$body); $body = str_replace($basehost,'#2basehost2#',$body); $body = preg_replace("/(]*)>)|(<//a>)/isU","",$body); $body = str_replace('#basehost#',$cfg_basehost,$body); $body = str_replace('#2basehost2#',$basehost,$body); } //自動摘要 if($description=='' && $cfg_auot_description>0) { $description = cn_substr(html2text($body),$cfg_auot_description); $description = trim(preg_replace('/ /','',$description)); $description = addslashes($description); } |
在這個下面的:
//自動獲取縮略圖
if($autolitpic==1 && $litpic=='') { $litpic = GetDDImgFromBody($body); } |
修改成:
//自動獲取縮略圖
//if($autolitpic==1 && $litpic=='') //{ //$litpic = GetDDImgFromBody($body); //} |
好了大功告成!
新聞熱點
疑難解答
圖片精選