Using ShareX + ImgURL: Automatically Upload and Retrieve Image Links After Taking Screenshots

Publish: 2019-11-10 | Modify: 2019-11-10

ShareX is an open-source screenshot tool that supports a series of operations after taking a screenshot, such as editing and uploading. It has powerful customization features, but it can be a bit difficult to get started with. I previously shared an article titled "Building Your Own Image Hosting Service with Upyun + ShareX". Today, I will share a method of automatically uploading screenshots taken with ShareX to ImgURL.

Installing ShareX

ShareX currently only supports Windows 7, 8.1, and 10, and does not support other systems. You can choose to install it from the official website or use the portable version according to your needs.

Installing ImgURL

ImgURL is an image hosting program developed by Xiaoz. You can go to the community version here: https://github.com/helloxz/imgurl. If you need a more powerful professional version, please go to: "ImgURL Pro Professional Edition Released, Supports Multiple External Storages, 40% off". ImgURL is developed using PHP, and you can easily install it according to the installation instructions in the documentation, whether it is the community version or the professional version. Assuming you have prepared ShareX and ImgURL, let's get started.

Configuring ShareX Custom Upload

Open ShareX, go to "Upload" and then "Custom Uploaders", as shown in the image below.

ImgURL Pro users, please copy the following JSON file: (Please modify it according to your own situation)

{
  "Version": "13.0.1",
  "Name": "ImgURL",
  "DestinationType": "ImageUploader",
  "RequestMethod": "POST",
  "RequestURL": "https://imgurl.org/upload/ftp",
  "Body": "MultipartFormData",
  "Arguments": {
    "token": "4764d7633392d7e2a9ee0725****"
  },
  "FileFormName": "file",
  "URL": "![]($json:url$)"
}

ImgURL Pro supports multiple external storages. The above example is for uploading to FTP. Please make sure you have enabled the external storages you want to use, and then modify the upload interface in the configuration to match your actual situation. The upload addresses for each storage are:

Note that "token": "4764d7633392d7e2a9ee0725****" refers to the token for administrator upload. You can view the upload token in the ImgURL Pro backend under "System Settings" - "Token Management".

Using a token means uploading as an administrator (not limited by the number of uploads). If you are providing uploads for guests, please remove the following parameters:

"Arguments": {
    "token": "4764d7633392d7e2a9ee0725****"
},

Note that "URL": "![]($json:url$)" by default returns the image link in Markdown format. If you want it to automatically return the image link in HTML format, modify it to:

"URL": "<img src='$json:url$' />"

You can modify it to any format you want. In short, $json:url$ is the parameter for the image link returned by ShareX.

Go back to ShareX Custom Upload settings, click on "Import" and choose "From Clipboard" to automatically import the configuration you just copied into ShareX.

If you are using ImgURL Community Edition (ignore if you are using the Professional Edition), please copy the following JSON configuration (youdomain.com should be replaced with your own domain name), and then import it into ShareX using the method described above.

{
  "Version": "13.0.1",
  "Name": "ImgURL",
  "DestinationType": "ImageUploader",
  "RequestMethod": "POST",
  "RequestURL": "https://youdomain.com/api/upload",
  "Body": "MultipartFormData",
  "FileFormName": "file",
  "URL": "![]($json:url$)"
}

Setting ShareX Shortcut Keys

Next, we will add a shortcut key in ShareX to complete a series of operations such as "take a screenshot + edit the image + upload the image + get the image URL". Go back to the ShareX main interface and click on "Shortcut Settings".

Click on the top left corner to add a shortcut key. Follow the steps and fill in the information as shown below. If you are not sure about the specific options, it is recommended to keep them consistent with the options below.

Then set a shortcut key that you are familiar with, which will be used for taking screenshots later. Xiaoz has set it as ALT + A.

Operation Demonstration

If the above settings are correct, you can now try taking a screenshot. After taking the screenshot, ShareX will automatically upload the image to ImgURL and return the image URL for you to use. (Click on the image below to enlarge it)

Conclusion

With the above operations, we can complete a series of continuous operations such as taking a screenshot, uploading the image, and getting the image URL. By mastering ShareX proficiently, you can achieve even more automation. However, ShareX can be a bit complex to use. If you encounter any problems during the setup, please leave a comment below and I will do my best to answer.

If you need ImgURL Pro Professional Edition for your image hosting, please click here: https://blog.xiaoz.org/archives/13225


Comments