grep jason_

Siri Shortcuts - Episode 7

Shortcut Name: Photo Upload to hosted / 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 media repository, and retrieve a link to that photo so that you can use it on your 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 endpoint.
  4. The response from the server is received as text.
    Example: {“url”:”http:\/\/\/uploads\/2018\/151f65c6fc.jpg”}
  5. Regex is used \B:|[{}”\\]|url to remove unnecessary characters, leaving you with a standard URL.
  6. Finally the cleaned up URL is copied to the clipboard.

"Source Code"
Shortcut Code Screenshot

Check out other shortcuts!