Imgur Image Uploader App
A sample app for Firefox OS for uploading images to imgur.
It can be used as a standalone app to post pictures to imgur.com as seen in:
Or as an activity handler for the share image activity as seen in:
index.html, share.html and app.js
Those files have the application that the user can launch and use the Pick Image and Upload button to select an image from some source and upload it to imgur.com. The share.html file is a copy of index.html that is loaded when the user uses the share activity to send an image from some app to the uploader app. We use this second file because if we use index.html as our activity handler page and the app is already open, it will simply switch to the app without loading the stuff.
This is a minimal imgur.com anonymous upload wrapper. The Imgur API is free to use for non-commercial low volume apps such as this one.
Usage of Web APIs
This application was made to demonstrate the usage of Web Activities. It can act as an activity handler for the share activity and it uses the pick activity to select images to be uploaded when launched as an app instead of being selected as an activity from the share menu.
You can learn more about Web Activities here.
Before trying to upload the image to imgur.com we check if the user is connected using the Connection API.
Upon successfully uploading an image to imgur.com, we display a notification using the Notification API.
Google Summer of Code
This app was created as a part of a collection of sample apps for Firefox OS during Google Summer of Code 2013. You can check my original proposal.