Skip to content

Instantly share code, notes, and snippets.

@Marak
Created April 4, 2011 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Marak/901220 to your computer and use it in GitHub Desktop.
Save Marak/901220 to your computer and use it in GitHub Desktop.
exports.exec = (options, callback) ->
# Load image
fs.readFile './image.jpg', (err, img) ->
if err
return callback(err, null);
# POST image to imgur
request {
method: 'POST',
body: "image=" + img.toString() + "&key=42e1c4982b52fabcae9033ff428d5175",
uri: 'http://imgur.com/api/upload.json',
}, (err, res, body) ->
if err
return callback err
callback(null, body)
@Marak
Copy link
Author

Marak commented Apr 4, 2011

u y {"rsp":{"stat":"fail","image":{"stat":"fail","error_code":9000,"error_msg":"No image was sent to the upload api"}}}

@Marak
Copy link
Author

Marak commented Apr 4, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment