dedecms文章内图片打上水印而缩略图不打水印

修改网站里  dede/inc/inc_archives_functions.php  文件


查找到:

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



这个函数里面有一句:

  1. @WaterImg($rndtrueName, 'down');


修改成:

  1. //@WaterImg($rndtrueName, 'down');




再查找:

  1. //获得文章body里的外部资源
  2. function GetCurContent($body)
  3. {
  4.     global $cfg_multi_site,$cfg_basehost,$cfg_basedir,$cfg_image_dir;



修改成:

  1. //获得文章body里的外部资源
  2. function GetCurContent($body)
  3. {
  4.     global $cfg_multi_site,$cfg_basehost,$cfg_basedir,$cfg_image_dir,$autolitpic,$litpic;
  5.     $autolitpic = (empty($autolitpic) ? '' : $autolitpic);



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

  1. $value = trim($value);
  2.         $rndFileName = $imgPath.'/'.$milliSecondN.'-'.$key.$itype;
  3.         $fileurl = $imgUrl.'/'.$milliSecondN.'-'.$key.$itype;
  4.         $rs = $htd->SaveToBin($rndFileName);



在其下面添加:

  1. //自动获取缩略图
  2.     if($autolitpic==1 && $litpic=='')
  3.     {
  4.         $litpic = GetDDImgFromBody($body);
  5.     }        



最后一步:
查找到:

  1. //处理HTML文本
  2. //删除非站外链接、自动摘要、自动获取缩略图
  3. function AnalyseHtmlBody($body,&$description,&$litpic,&$keywords,$dtype='')
  4. {
  5.     global $autolitpic,$remote,$dellink,$autokey,$cfg_basehost,$cfg_auot_description,$id,$title,$cfg_soft_lang;
  6.     $autolitpic = (empty($autolitpic) ? '' : $autolitpic);
  7.     $body = stripslashes($body);
  8.     //远程图片本地化
  9.     if($remote==1)
  10.     {
  11.         $body = GetCurContent($body);
  12.     }
  13.     //删除非站内链接
  14.     if($dellink==1)
  15.     {
  16.         $basehost = "http://".$_SERVER['HTTP_HOST'];
  17.         $body = str_replace($cfg_basehost,'#basehost#',$body);
  18.         $body = str_replace($basehost,'#2basehost2#',$body);
  19.         $body = preg_replace("/(<a[ ]{1,}href=["']{0,}http://[^/]([^>]*)>)|(</a>)/isU","",$body);
  20.         $body = str_replace('#basehost#',$cfg_basehost,$body);
  21.         $body = str_replace('#2basehost2#',$basehost,$body);
  22.     }
  23.     //自动摘要
  24.     if($description=='' && $cfg_auot_description>0)
  25.     {
  26.         $description = cn_substr(html2text($body),$cfg_auot_description);
  27.         $description = trim(preg_replace('/#p#|#e#/','',$description));
  28.         $description = addslashes($description);
  29.     }



在这个下面的:

  1. //自动获取缩略图
  2.     if($autolitpic==1 && $litpic=='')
  3.     {
  4.         $litpic = GetDDImgFromBody($body);
  5.     }



修改成:

    1. //自动获取缩略图
    2.     //if($autolitpic==1 && $litpic=='')
    3.     //{
    4.         //$litpic = GetDDImgFromBody($body);
    5.     //}
原文地址:https://www.cnblogs.com/qmtx3/p/3421485.html