62°F

Aaron Parecki

  • Articles
  • Notes
  • Photos
  • Automatically uploading screenshots to a Micropub Media Endpoint

    November 2, 2016

    I often want to share screenshots in text chat from my computer, and I don't like sharing Dropbox links since they load a huge HTML+JS app just to show an image.

    Since I already have a Micropub Media Endpoint that apps like Quill use to upload photos, I thought that would be a good place to also share screenshots from. The Media Endpoint is a simple HTTP API. It accepts a file upload, and returns the URL to the file in the Location header.

    OSX has what's called "Folder Actions" where the system will trigger a script to run any time a file is added to a folder. I created an Automator script that will upload the newly added file to the media endpoint, and copy the resulting URL onto the clipboard.

    The curl command I used is below. Of course you'll want to change the values of the access token and endpoint URL for yourself:

    curl -i -F "file=@$1" -H "Authorization: Bearer xxx" https://media.aaronpk.com/endpoint.php 
    | grep Location: | sed -En 's/^Location: (.+)/\1/p' | tr -d '\r\n' | pbcopy

    To activate the Folder Action, save this in:

    ~/Library/Workflows/Applications/Folder Actions/

    Now, open Finder to the folder where your screenshots are saved, and right click the folder and navigate to "Folder Actions Setup".

    Attach the script to the folder in the window that appears. Your script should appear in the list once you've saved it to your "Folder Actions" folder in ~/Library.

    Now, whenever you take a screenshot (or drop any other file in that folder), the Automator workflow will run and will upload your image to your media endpoint! After a few seconds, you should see a popup notification that the URL to your file is on your clipboard.


    Portland, Oregon
    Wed, Nov 2, 2016 12:40pm -07:00 #screenshot #micropub #media-endpoint #indieweb
    1 like 3 replies 3 mentions
    • eli
    • Aaron Parecki aaronparecki.com
      @dropshareformac Basically I want to use Dropshare instead of this hacked up folder automation workflow https://aaronparecki.com/2016/11/02/5/screenshots
      Wed, May 24, 2017 8:08am -07:00
    • Tyler tyler.cat/profile/tyler

      How does quill discover media url, never figured it out

      Sat, Nov 5, 2016 4:30am +00:00
    • Ryan Barrett snarfed.org

      fun! i’ve always been low tech about this, i just scp files to my server. simple, and a single small command, but the automation here is very cool.

      Thu, Nov 3, 2016 7:08am -07:00

    Other Mentions

    • Eli Mellen eli.li
      🙌 Liked: aaronparecki.com/2016/11/02/5/s…eli.li/entry.php?id=2…
      Wed, Jun 14, 2017 2:37pm +00:00 (via brid-gy.appspot.com)
    • Sebastiaan Andeweg seblog.nl
      Another take on uploading screenshots to a Micropub Media Endpoint
      Mon, Jan 2, 2017 6:46am -07:00
    • Tyler tyler.cat/profile/tyler
      Tyler Automatically uploading screenshots to a Micropub Media Endpoint • Aaron Parecki Tylerpublished this 03 Nov 2016 0 stars 0 comments
      Thu, Nov 3, 2016 1:49am +00:00
Posted in /articles using quill.p3k.io

Hi, I'm Aaron Parecki, Director of Identity Standards at Okta, and co-founder of IndieWebCamp. I maintain oauth.net, write and consult about OAuth, and participate in the OAuth Working Group at the IETF. I also help people learn about video production and livestreaming. (detailed bio)

I've been tracking my location since 2008 and I wrote 100 songs in 100 days. I've spoken at conferences around the world about owning your data, OAuth, quantified self, and explained why R is a vowel. Read more.

  • Director of Identity Standards at Okta
  • IndieWebCamp Founder
  • OAuth WG Editor
  • OpenID Board Member

  • 🎥 YouTube Tutorials and Reviews
  • 🏠 We're building a triplex!
  • ⭐️ Life Stack
  • ⚙️ Home Automation
  • All
  • Articles
  • Bookmarks
  • Notes
  • Photos
  • Replies
  • Reviews
  • Trips
  • Videos
  • Contact
© 1999-2025 by Aaron Parecki. Powered by p3k. This site supports Webmention.
Except where otherwise noted, text content on this site is licensed under a Creative Commons Attribution 3.0 License.
IndieWebCamp Microformats Webmention W3C HTML5 Creative Commons
WeChat ID
aaronpk_tv