广告投放

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

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
广告位招租919838898
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索