About three weeks ago, I wrote an article documenting the method of automatically uploading pasted images to Dogedoge Image Hosting using VSCode. However, during my usage in the past few weeks, I gradually discovered its limitations: it seems that due to access restrictions, this extension can only upload temporary photos from the clipboard and cannot upload locally copied photos properly. The specific issue is that the uploaded image is empty.
This prompted me to try other methods and ultimately decide to switch to vs-picgo.
Using the vs-picgo Extension#
In the first article, I also mentioned that the README.md file of vs-picgo states that it only supports the eight image hosting services supported by picgo-core and that the plugin system is still a work in progress:
vs-picgo supports 8 kinds of image hosting services: weibo, qiniu, tcyun, upyun, github, aliyun, imgur and SM.MS, which are supported by PicGo-Core. And the plugin feature of PicGo-Core is working in progress.
It was because of this statement that I gave up on trying it out and went through the exploration process after the first article. However, after manually installing and trying it out this time, I realized that I may have misunderstood the developer's intention.
Upon careful examination of the vs-picgo settings, I found a configuration item called "Config path," with the following description: The path to your Picgo-Core configuration. Picgo will use Picgo: Pic Bed if this is not specified. In other words, we can now override the settings of this extension itself by specifying the location of the Picgo Core configuration file, and thus use third-party plugins of Picgo Core. The unfinished aspect of vs-picgo may only refer to the graphical configuration of the plugin system...
Since that's the case, the goal is clear. We just need to install Picgo Core and configure it accordingly, and finally specify the configuration file path in the extension.
Installing Picgo Core#
Refer to the README.md. For global installation, simply run:
yarn global add picgo
# or
npm install picgo -g
Configuring Picgo Core#
To upload to Dogedoge Image Hosting, we need to install the web-uploader plugin and configure it.
picgo install web-uploader
picgo config uploader
? Choose a(n) uploader # Select web-uploader
? API address # Enter your upload address
? POST parameter name # file
? Image URL JSON path (eg: data.url) # data.o_url
? Custom request headers Standard JSON (eg: {"key":"value"}) # Leave blank
? Custom Body Standard JSON (eg: {"key":"value"}) # Leave blank
picgo use uploader
? Use an uploader # Select web-uploader
After configuring, you can test if the upload is working properly by running picgo upload /path/to/an/image
. If the upload is successful, it means the configuration is correct.
Configuring vs-picgo#
The final step is to specify the configuration file of picgo core in the vs-picgo settings. Refer to the official documentation:
The default configuration file for picgo is ~/.picgo/config.json. Where ~ represents the user directory. The user directory may vary depending on the operating system.
For Linux and macOS, it is ~/.picgo/config.json.
For Windows, it is C:\Users\YourUsername.picgo\config.json.
For example, the configuration on GNU/Linux:
Using vs-picgo#
Finally, let's talk about how to use it. The default shortcuts are as follows:
OS | Uploading an image from clipboard | Uploading images from explorer | Uploading an image from input box |
---|---|---|---|
Windows/Unix | Ctrl + Alt + U | Ctrl + Alt + E | Ctrl + Alt + O |
Os X | Cmd + Opt + U | Cmd + Opt + E | Cmd + Opt + O |