Tutorial reference

Typora+PicGo-Core(Command line)+Gitee image upload to map bed mainly reference PicGo operation command

Typora + PicGo + Gitee realize the automatic uploading of pictures to the map bed mainly draw on the construction of Gitee map bed

The use of Gitee to build their own graph bed mainly refers to the opening of Gitee Pages service

1. Prepare the Node environment

Please solve by yourself…

2. Use Node to install picgo-core

// NPM command execution speed is too slow, Could we use the taobao image of NPM install - g picgo - registry=https://registry.npm.taobao.org / / after the installation is complete test whether successful installation picgo - vCopy the code

3. Run the picgo command to install the gadee-Uploader plug-in

picgo install gitee-uploader
Copy the code

4. Run the picgo command to set uploader

C:\Users\Run\Desktop>picgo setuploader ? 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: monthly? customUrl: https://gitee.com/xxxx/image/raw/master/ [PicGo SUCCESS]: Configure config successfully!Copy the code

5. Configure the Typro upload service

Focus on the component of the custom command: [your Node path] [your picgo path] upload

key value
Upload service Custom Command
Custom commands D:\nodejs\node.exe D:\nodejs\node_global\node_modules\picgo\bin\picgo upload

Note: click after the configuration is completeVerify image upload optionsTo test whether the configuration is successful

6. Complete configuration files

Here is the referencePicgo-core official documentationThe configuration of

First we need to find our configuration file, picgo’s default configuration file is not quite the same in different directories on different systems: For Linux and macOS it is ~/.picgo/config.json and for Windows it is C:\Users\{your username}\.picgo\config.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": "The 2020-07-30 10:29:26"}}Copy the code

7. SolveThe file is larger than 1 MB and can be seen after loginThe problem of

We did manage to configure a free Gitee chart bed by following steps 1-6. However, when the size of the picture we uploaded exceeded 1M: OMG, the picture could not be displayed normally. When I opened the address of the picture in the browser, I directly jumped to the Gitee login interface, and there appeared a disturbing message indicating that the file was larger than 1M and the text could be seen after login. The key is that there is no solution to the file size limit, cool!!

Cool? It doesn’t exist! As the saying goes: the way is always more than difficult. There isn’t just one way to access files in a Git repository, let alone static resource files. So maybe we just need to figure out how to configure a simple HTTP service. Problem solved: Gitee officially provides a Git Pages service for blogs/portals/open source project sites/static effect demonstrations of open source projects.

7.1 Starting the Git Pages service

  1. Enter your Gitee chart bed warehouse page, findservice -> Gitee Pages

  1. You do not need to modify any configuration. Just clickStart theButton to wait until the service is started.

7.2 Updating the Image Access path

When Git Pages is enabled for your repository, you will get a dedicated site address in the format of “personal space address.giee. IO/repository name”.

For example: http://zi1.gitee.io/pic, the path to access the static resource files in the graph bed is http://zi1.gitee.io/pic + the visible path of the files in the repository.

Such as: picture (1) in the directory of your warehouse JPG image files: picture / 1. JPG, we access to the path of the image is: http://zi1.gitee.io/pic/picture/1.jpg

8. Complete the configuration file after Git Pages is enabled

{
  "picBed": {
    "current": "gitee"."gitee": {
      "repo": "xxxx/image"."branch": "master"."token": "5a34fa3f348d556..."."path": "2020"."customPath": "yearMonth"."customUrl": "https://xxxx.gitee.io/image/"
    },
    "uploader": "gitee"."transformer": "path"
  },
  "picgoPlugins": {
    "picgo-plugin-gitee-uploader": true
  },
  "picgo-plugin-gitee-uploader": {
    "lastSync": "The 2020-10-12 09:23:39"}}Copy the code