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?
- Ask user to select a photo from their photo library.
- Converts the photo highest quality .jpg. (this mitigates any issues if the photo is .HEIC)
- It now posts the converted photo to the https://micro.blog/micropub/media endpoint.
- The response from the server is received as text.
Example:{“url”:”http:\/\/www.burk.io\/uploads\/2018\/151f65c6fc.jpg”}
- Regex is used
\B:|[{}”\\]|url
to remove unnecessary characters, leaving you with a standard URL.
Example: http://burk.micro.blog/uploads/2018/151f65c6fc.jpg - Finally the cleaned up URL is copied to the clipboard.
“Source Code”
Check out all the Shortcuts on Github