Implementing One-Click Screenshot Upload to Image Hosting with Alfred

Implementing One-Click Screenshot Upload to Image Hosting with Alfred

4月 4, 2020 · 2 分钟阅读时长 · 393 字 · -阅读 -评论

Because my personal blog migrated from China to overseas, the server was destroyed and the registered domain became invalid. The blog’s images and other resources had been using Qiniu Cloud image hosting + custom domain, so they were affected and stopped working. When considering a new image hosting service, I tried imgur, but that service is blocked in China - overall, it was frustrating.

After enduring this situation for a while, I decided to build my own image hosting service while migrating historical image resources from Qiniu Cloud to ensure that images in previous blog posts could be accessed normally. At the same time, to quickly upload image resources, I created a convenient workflow using Alfred.

Here’s a simple record of the entire process.

Batch Downloading Qiniu Image Hosting Resources

Regarding images hosted on Qiniu Cloud, I discovered they couldn’t be previewed or downloaded, which was really frustrating. Fortunately, their customer service is quite good, and after consulting with them, I learned the solution.

https://developer.qiniu.com/kodo/tools/5972/kodo-browser

For the complete solution provided by Qiniu customer service, check here

Implementing Static Resource Hosting with VPS

Creating your own image hosting service is actually just having a web service that can be accessed on the public internet. Since my blog itself is already hosted on a VPS, I only needed to modify the configuration:

  1. Add domain resolution in DNS, for example, I used static.1991421.cn
  2. Configure Nginx accordingly, find detailed information on your own

Implementing One-Click Image Upload with Alfred

The previously used iPic doesn’t support custom image hosting services. So I had to give it up and build my own solution.

Here I implemented a Workflow with Alfred.

How to Use

Either take a screenshot or select an image file, copy with ⌘ C, then upload with one key combination ⌥ ⌘ U, and ⌘ V to paste the resulting markdown format web address.

The effect is as follows:

If you need the Alfred Workflow, click here

Conclusion

  1. After all this effort, previously inaccessible blog image resources were finally recovered and restored to normal
  2. Image resources in my writing can finally be controlled and managed by myself; imgur and Qiniu are no longer needed
  3. Alfred’s support ensures that the upload experience is essentially the same as before, without creating additional operational costs.

So, it was worth the effort.

References

Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源