静态用于博主图像



目前,博客图片是从1.bp.blogspot.com2.bp.blogspot.com3.bp.blogspot.com加载的

有没有办法,静态加载上传的图像。

示例:https://2.bp.blogspot.com/-zz2hQ1thv8w/V_YilPYNecI/AAAAAAAABFQ/OwC5dN0Rbo4eoXTrQ82E4k3arwfzxeBqwCK4B/s1600-e365/Figure-1-New-Ballard-score-Reprinted-with-permission-from-Ballard-JL-Khoury-JC-Wedig.png

自动转换为

https://cdn.statically.io/img/2.bp.blogspot.com/-zz2hQ1thv8w/V_YilPYNecI/AAAAAAAABFQ/OwC5dN0Rbo4eoXTrQ82E4k3arwfzxeBqwCK4B/s1600-e365/Figure-1-New-Ballard-score-Reprinted-with-permission-from-Ballard-JL-Khoury-JC-Wedig.png

我的意思是:有什么脚本可以在图像网址之前自动添加cdn.statically.io/img/

这里有一个简单的 javascript 代码来替换所有图像的开头,不要忘记将其包装在<script>标签中:

document.querySelectorAll('img').forEach(function(img){
img.src = img.src.replace(/(http|https):///,'https://cdn.statically.io/img/');
}); 

最新更新