meteor add simple:imgur
A meteor package that lets you upload images to Imgur. Is very nice to use with mdg:camera
, as in the example app included in this repo.
Both API methods work on client and server.
options
(required) an object with options, described below.callback(error, data)
(required) a callback that is called with two arguments, 'error', and 'data'.error
a Meteor.Error describing the reason the photo could not be uploaded.data
an object that contains the response from the Imgur API, documented here. The most useful properties aredata.link
, which contains the URL of the newly uploaded image, anddata.deletehash
, which contains the id used for deleting the image later on.
apiKey
the Imgur Client ID. Get it by signing up for the API at https://api.imgur.com/oauth2/addclient.image
the image data, can be a base64-encoded image data string or the URL of an image somewhere on the internet.mashapeKey
optional Mashape key, necessary for commercial use apps. If provided, the method will request to the mashape endpoint instead of the regular imgur one.type
,name
,title
,description
,album
optional properties exactly as documented at https://api.imgur.com/endpoints/image#image-upload.
imageUrl
the URL for an image on Imgur, for example "http://i.imgur.com/wbJ84Wm.jpg".size
the key of the desired thumbnail size, chosen from the list at the bottom of https://api.imgur.com/models/image. You can also use a constant from the list below.Imgur.SMALL_SQUARE
Imgur.BIG_SQUARE
Imgur.SMALL_THUMBNAIL
Imgur.MEDIUM_THUMBNAIL
Imgur.LARGE_THUMBNAIL
Imgur.HUGE_THUMBNAIL
options
(required) an object with options, described below.callback(error, data)
(required) a callback that is called with two arguments, 'error', and 'data'.error
a Meteor.Error describing the reason the photo could not be deleted.data
an object that contains the response from the Imgur API, documented here. In this case, a boolean value.
apiKey
the Imgur Client ID. Get it by signing up for the API at https://api.imgur.com/oauth2/addclient.deleteHash
the delete hash, retrieved in the response object of theupload
methodmashapeKey
optional Mashape key, necessary for commercial use apps. If provided, the method will request to the mashape endpoint instead of the regular imgur one.