Follow @Burk on Micro.blog.

Shortcuts Ep. 7

Siri Shortcuts - Episode 7

Shortcut Name: Photo Upload to hosted Micro.blog / Retrieve URL
Revision: 1.0
Add to Shortcuts!

What does it do?
This Shortcut lets you select a photo from your library and upload it to your hosted micro.blog media repository, and retrieve a link to that photo so that you can use it on your micro.blog hosted pages without the need to link out to external storage.

How does it work?
1. Ask user to select a photo from their photo library.
2. Converts the photo highest quality .jpg. (this mitigates any issues if the photo is .HEIC)
3. It now posts the converted photo to the https://micro.blog/micropub/media endpoint.
4. The response from the server is received as text.
Example: {“url”:”http:\/\/www.burk.io\/uploads\/2018\/151f65c6fc.jpg”}
6. Regex is used \B:|[{}”\\]|url to remove unnecessary characters, leaving you with a standard URL.
Example: http://micro.burk.io/uploads/2018/151f65c6fc.jpg
7. Finally the cleaned up URL is copied to the clipboard.

“Source Code”
Shortcut  Episode 7  Code

Check out all the Shortcuts on Github