详解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的远程图片也本地化了


标签:织梦DedeCMS

相关阅读 >>

dede二级域名(多站点)绑定详解

dede 标签调用大全 dedecms 隔五行一个分割线等标签调用

dedecms增加自定义文件名功能

dedecms获取图片集多张图片实现方法(循环输出)

dedecms限制会员每天投稿数量的解决方法

详解自己动手添加一个函数实现任意字段调用

fatal error call to a member function read() on a non-object in 错误解决方法

dede(织梦)网站前端仿站步骤教程

dedecms网站搭建完整教程

织梦文章系统修改专题文章列表的模板的方法

更多相关阅读请进入《织梦DedeCMS》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...