Typora + PicGo-Core + Custom Command 实现上传图片到图床

教程参考

Typora+PicGo-Core(command line)+Gitee实现图片上传到图床 主要借鉴 picgo 操作命令

Typora + PicGo + Gitee 实现图片自动上传到图床 主要借鉴 gitee 图床的搭建

1. node 环境准备

请自行百度解决...

2. 使用 node 安装 PicGo-Core

// npm 命令执行速度过慢的话,我们可以使用一下淘宝的镜像 
npm install -g picgo --registry=https://registry.npm.taobao.org

// 安装完成以后测试一下是否安装成功
picgo -v

3. 使用 picgo 命令安装 gitee-uploader 插件

picgo install gitee-uploader

4. 使用 picgo 命令设置 uploader

C:UsersRunDesktop>picgo set uploader
? Choose a(n) uploader (Use arrow keys)
❯ gitee
  smms
  tcyun
  github
  qiniu
  imgur
  aliyun
  upyun
(Move up and down to reveal more choices)

? Choose a(n) uploader gitee
? repo: xxxx/image
? branch: master
? token: 5a34fa3f348d556...
? path: 2020
? customPath: 年月
? customUrl: https://gitee.com/xxxx/image/raw/master/
[PicGo SUCCESS]: Configure config successfully!

5. 配置 Typro 上传服务设定

重点是 自定义命令 的组成部分: [your node path] [your picgo path] upload

上传服务 Custom Command
自定义命令 D: odejs ode.exe D: odejs ode_global ode_modulespicgoinpicgo upload

注意:配置完成后可以点击 验证图片上传选项 来测试是否配置成功

6. 完整的配置文件

以下是参照 PicGo-Core官方文档 的进行的配置

首先我们需要找到我们的配置文件,picgo 的默认配置文件在不同系统的目录不太一样:
linux 和 macOS 均为 ~/.picgo/config.json
windows 则为 C:Users{你的用户名}.picgoconfig.json

{
  "picBed": {
    "current": "gitee",
    "gitee": {
      "repo": "xxxx/image",
      "branch": "master",
      "token": "5a34fa3f348d556...",
      "path": "2020",
      "customPath": "yearMonth",
      "customUrl": "https://gitee.com/xxxx/image/raw/master/"
    },
    "uploader": "gitee",
    "transformer": "path"
  },
  "picgoPlugins": {
    "picgo-plugin-gitee-uploader": true
  },
  "picgo-plugin-gitee-uploader": {
    "lastSync": "2020-07-30 10:29:26"
  }
}
原文地址:https://www.cnblogs.com/Run2948/p/13408419.html