typecho博客使用markdown无法加载图片,在浏览器上出现以下403错误。
解决办法:
以handsome主题为例,修改header.php
vim ../usr/themes/handsome/component/header.php
添加以下一行代码:
<meta name="referrer" content="no-referrer" />
如果还不行在请求到的图片链接前面加上 https://images.weserv.nl/?url={图片地址}
修改content.php文件vim ./usr/themes/handsome/libs/Content.php
,通过关键字$backgroundImageHtml
找到修改代码处,添加以下代码:
$imgSrcTmp = $parameterArray['imgSrc'];
if(strpos($imgSrcTmp,'yuque') !== false){
$backgroundImageHtml = Utils::returnDivLazyLoadHtml('https://images.weserv.nl/?url='.$parameterArray['imgSrc'], 800, 0);
}else{
$backgroundImageHtml = Utils::returnDivLazyLoadHtml($parameterArray['imgSrc'], 800, 0);
}
同样在libs/Content.php添加以下代码:(在$content = PostContent::postContent($obj, $status, $way);
下方添加)
str_replace("https://cdn.nlark.com/yuque","https://images.weserv.nl/?url=https://cdn.nlark.com/yuque",$content);
其他图片缓存镜像
https://img.noobzone.ru/getimg.php?url=
https://collect34.longsunhd.com/source/plugin/yzs1013_pldr/getimg.php?url=
https://ip.webmasterapi.com/api/imageproxy/
https://images.weserv.nl/?url=
https://pic1.xuehuaimg.com/proxy/
https://search.pstatic.net/common?src=