国内外主机
测评及优惠码

dedecms织梦远程图片本地化https链接图片无法本地化怎么解决

最近有朋友遇到发布文章时候文章里面带https的站外图片无法本地化,以下是解决办法:
找到  dede//inc/inc_archives_functions.php文件里面GetCurContent($body)这个函数,里面
preg_match_all(“/src=[“|'|s]{0,}(http://([^>]*).(gif|jpg|png))/isU”,$body,$img_array);
$img_array = array_unique($img_array[1]);
这一段改为:

preg_match_all("/src=["|'|s]{0,}(http://([^>]*).(gif|jpg|png))/isU",$body,$img_array);
preg_match_all("/src=["|'|s]{0,}(https://([^>]*).(gif|jpg|png))/isU",$body,$img_array_https);
$img_array = array_unique($img_array[1]);
$img_array_https = array_unique($img_array_https[1]);
$img_array=array_merge_recursive($img_array,$img_array_https);

第二步:

if(!preg_match("#^http://#i", $value))
{
continue;
}

这一段改为:

查看源码

打印代码帮助

if(!preg_match("#^http://#i", $value)&&!preg_match("#^https://#i", $value))
{
continue;
}

搞定,这样发文章就可以把https的远程图片也本地化了

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《dedecms织梦远程图片本地化https链接图片无法本地化怎么解决》
文章链接:https://www.ibytx.com/967.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

登录

找回密码

注册