DedeCMS v5.6文章内图片打上水印而缩略图不打水印的方法

测试版本为 DEDECMS V5.6

第一步是要在后台打开水印功能, 两个勾都要选上

第二步是修改你网站里 dede/inc/inc_archives_functions.php 文件 (dede为后台默认路径)

查找到:http://asqq8.net/

//获取一个远程图片function GetRemoteImage($url,$uid=0)

这个函数里面有一句:

@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);

然后在这同一个函数里面查找到:

$value = trim($value); $rndFileName = $imgPath.’/’.$milliSecondN.’-‘.$key.$itype; $fileurl = $imgUrl.’/’.$milliSecondN.’-‘.$key.$itype; $rs = $htd->SaveToBin($rndFileName);

在其下面添加:

//自动获取缩略图 if($autolitpic==1 && $litpic==”) { $litpic = GetDDImgFromBody($body); }

最后一步:查找到:http://asqq8.net/

//处理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); }

//删除非站内链接 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(‘/路灯和我之间,究竟谁是谁的过客,

DedeCMS v5.6文章内图片打上水印而缩略图不打水印的方法

相关文章:

你感兴趣的文章:

标签云: