Skip to content

Instantly share code, notes, and snippets.

@jennschiffer
Created March 4, 2014 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennschiffer/9348545 to your computer and use it in GitHub Desktop.
Save jennschiffer/9348545 to your computer and use it in GitHub Desktop.
make8bitart upload to imgur
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