Typora+PicGo-core插入图片自动上传+gitee,gitgub,sm

Typora+PicGo-core插入图片自动上传+gitee,gitgub,sm.ms三种免费图床

1 安装插件
2 配置config.json
2.1 设置SMMS
2.2 设置gitee
2.3 设置github

最近写博文,原来用的SMMS作为图床突然间抽风,出现下面错误

1
2
3
4
5
6
2020-05-27 19:27:18 [PicGo INFO] Before transform
2020-05-27 19:27:18 [PicGo INFO] Transforming...
2020-05-27 19:27:18 [PicGo INFO] Before upload
2020-05-27 19:27:18 [PicGo INFO] Uploading...
2020-05-27 19:27:19 [PicGo WARN] failed
2020-05-27 19:27:19 [PicGo ERROR] StatusCodeError: 503

因此改用gitee作为图床。

原因:由于PicGo-Core(command line)没有包含gitee插件,因此只安装gitee插件

1 安装插件

1
2
3
4
5
C:\Users\ggk\AppData\Roaming\Typora\picgo\win64

.\picgo.exe install smms-user
.\picgo.exe install gitee-uploader
.\picgo.exe install github-plus

2 配置config.json

第一步:

1
2
3
C:\Users\ggk\AppData\Roaming\Typora\picgo\win64

picgo set uploader

技术分享图片

中间一定要申请自己的API

第二步:

1
2
3
C:\Users\ggk\AppData\Roaming\Typora\picgo\win64

picgo use uploader

2.1 设置SMMS

1
2
3
4
5
6
7
8
9
10
11
12
13
{
"picBed": {
"current": "smms-user",
"uploader": "smms-user",
"smms-user": {
"Authorization": ""
},
"transformer": "path"
},
"picgoPlugins": {
"picgo-plugin-smms-user": true
}
}

2.2 设置gitee

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"picBed": {
"current": "gitee",
"gitee": {
"repo": "IT-cute/Picbed",
"branch": "master",
"token": " ",
"path": "img/",
"customPath": "default",
"customUrl": "https://gitee.com/IT-cute/Picbed/raw/master/"
},
"uploader": "gitee",
"transformer": "path"
},
"picgoPlugins": {
"picgo-plugin-gitee-uploader": true,
"picgo-plugin-smms-user": true
},
"picgo-plugin-gitee-uploader": {
"lastSync": "2020-05-28 12:21:13"
}
}

技术分享图片

指定存储路径:一般写/img,会在设定的仓库中创建img文件夹,也可以取另外的名字。

技术分享图片

2.3 设置github

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"picBed": {
"current": "github",
"github": {
"repo": "IT-cute/Picbed",
"branch": "master",
"token": "",
"path": "img/",
"customUrl": "https://github.com/IT-cute/Picbed"
},
"uploader": "github",
"transformer": "path"
},
"picgoPlugins": {
"picgo-plugin-gitee-uploader": true,
"picgo-plugin-smms-user": true
}
}

技术分享图片

  • 仓库名的格式是GitHub用户名\仓库名,
  • 分支名就用默认的主分支master。
  • token上一步在github里生成的token。
  • 指定存储路径指的是在GitHub仓库里面的路径,我写了img/,所以我的仓库下面会生成一个img目录,所有图片都会上传到这个img目录下。指定存储路径不是必填项,可以不写。

技术分享图片

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
"picBed": {
"current": "githubPlus",
"uploader": "githubPlus",
"githubPlus": {
"branch": "master",
"customUrl": "https://cdn.jsdelivr.net/gh/aisyun/img",
"path": "",
"repo": "aisyun/img",
"token": ""
},
"gitee": {
"branch": "master",
"customPath": "yearMonth",
"customUrl": "",
"path": "img/",
"repo": "gitee用户名/gitee仓库名",
"token": "自己的token"
},
"smms-user": {
"Authorization": "替换成你自己的token"
},
"transformer": "path"
},
"picgoPlugins": {
"picgo-plugin-gitee-uploader": false,
"picgo-plugin-smms-user": false,
"picgo-plugin-github-plus": true
},
"picgo-plugin-gitee-uploader": {
"lastSync": "2020-04-07 11:04:58"
},
"picgo-plugin-github-plus": {
"lastSync": "2020-04-07 11:09:08"
}
}

image-20220314165043619