grep jason_
omg.lol

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”}
  5. Regex is used \B:|[{}”\\]|url to remove unnecessary characters, leaving you with a standard URL.
    Example: http://www.burk.io/uploads/2018/151f65c6fc.jpg
  6. Finally the cleaned up URL is copied to the clipboard.

"Source Code"
Shortcut Code Screenshot

Check out other shortcuts!