图片下载
把gitee上所有图片的安装包下载下来
阿里云配置
https://zhuanlan.zhihu.com/p/138878534
picgo配置
picgo桌面版安装包:https://www.cnblogs.com/yangyu-IoT/p/12643611.html
之前用gitee作图床的时候下载的是command版直接用就可以
配置文件修改
windows上picgo配置文件位置C:\Users\xxx\.picgo
旧图片链接修改
使用python脚本修改之前图片的链接(有点麻烦)
例如:下面有{xxx}的地方需要根据你自己的用户名等等修改
原链接:https://gitee.com/{xxx}/images/raw/master/images/image-202202daas105947563.png)
新链接:https://{xxx}.oss-cn-{xxx}.aliyuncs.com/img/images/image-202202daas105947563.png)
import os
# 用于获取所在笔记所在路径
path = "D:\\坚果云\\notesystem\\mysql\\"
files = []
for file in os.listdir(path):
if file.endswith(".md"): # 排除文件夹内的其它干扰文件,只获取markdown文件
files.append(path + file)
for mdfile in files:
with open(mdfile, encoding="utf-8", mode='r+') as f:
t = f.read()
t = t.replace('gitee.com/{xxx}/images/raw/master/', '{xxx}.oss-cn-{xxx}.aliyuncs.com/img/')
# 读写偏移位置移到最开始处
f.seek(0, 0)
f.write(t)
print(t)
# 设置文件结尾 EOF
f.truncate()
缺点是只能一个目录一个目录更改旧链接