设为首页 - 加入收藏
广告 1000x90
您的当前位置:主页 > 网站运营 > 正文

织梦dede内容图片和缩略图自动带绝对域名

来源:网络分享 编辑:引流技巧 时间:2026-05-10

今天早上就把后面的代码写完了.我直接写代码吧.首先关于缩略图这块

然后打开 include\dialog\select_images_post.php这个文件,然后在108行

  • $fileurl = $activepath.'/'.$filename;
  • 改为

  • $fileurl = $cfg_basehost.$activepath.'/'.$filename;
  • 这里的意思就是编辑器上传的时候,带上域名这样的绝对路径.

    然后打开/dede/inc/inc_archives_functions.php找到436行的样子

  • global $cuserLogin,$cfg_ddimg_width,$cfg_ddimg_height,$cfg_basedir,$ddcfg_image_dir,$cfg_addon_savetype;
  • 改为

  • global $cfg_basehost,$cuserLogin,$cfg_ddimg_width,$cfg_ddimg_height,$cfg_basedir,$ddcfg_image_dir,$cfg_addon_savetype;
  • 找到481行的样子

  • if($isremote==1 && preg_match("#^http:\/\/#i", $picname))
  • 改成

  • if(($isremote==1 && preg_match("#^http:\/\/#i", $picname)) && !checkstr($picname,$cfg_basehost))
  • 找到502行的样子

  • if(($litpic=='ddfirst' && !preg_match("#^http:\/\/#i", $picname))
  • 改为

  • if(($litpic=='ddfirst' && !preg_match("#^http:\/\/#i", $picname)) || ($litpic=='ddfirst' && checkstr($picname,$cfg_basehost)))
  • 找到503行的样子

  • $oldpic = $cfg_basedir.$picname;
  • 在这句代码的上面加一句

  • $picname = str_replace($cfg_basehost,'',$picname);
  • 然后可以把滚动条拉到最下面 加入以下函数:

  • function checkstr($str,$str1){
  • //判断是否包含$str1这个字符
  • $tmparray = explode($str1,$str);
  • if(count($tmparray)>1){
  • return true;
  • } else{
  • return false;
  • }
  • }

    相关推荐:

    栏目分类

    微商引流技巧网 www.yinliujiqiao.com 联系QQ:1716014443 邮箱:1716014443@qq.com

    Copyright © 2019-2024 强大传媒 吉ICP备19000289号-9 网站地图 rss地图

    Top