Created
April 4, 2011 06:51
-
-
Save Marak/901220 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Author
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
u y {"rsp":{"stat":"fail","image":{"stat":"fail","error_code":9000,"error_msg":"No image was sent to the upload api"}}}