Created
March 4, 2014 15:28
-
-
Save jennschiffer/9348545 to your computer and use it in GitHub Desktop.
make8bitart upload to imgur
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
var uploadToImgur = function() { | |
var imgDataURL = DOM.$canvas[0].toDataURL('image/png').replace(/^data:image\/(png|jpg);base64,/, ''); | |
$.ajax({ | |
method: 'POST', | |
url: 'https://api.imgur.com/3/image', | |
headers: { | |
Authorization: 'Client-ID ' + imgur.clientId, | |
}, | |
dataType: 'json', | |
data: { | |
image: imgDataURL, | |
type: 'base64', | |
title: 'made on make8bitart.com!', | |
}, | |
success: function(result) { | |
var id = result.data.id; | |
console.log('success','https://imgur.com/gallery/' + id); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment