一直以來我們都是以為HTTPS網站安全性增強了,無法采集復制圖片本地化,通過技術上研究發現,通過修改織夢后臺系統文件可以解決圖片無法遠程本地化。
今天我們詳解dedecms織夢遠程圖片本地化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的遠程圖片也本地化了。
新聞熱點
疑難解答