I signed up for the Imgur API and registered a test application and got a client ID and client secret.
Then I tried using this code:
try { var image = canvas.toDataURL('image/jpeg', 0.9).split(',')[1]; } catch(e) { var image = canvas.toDataURL().split(',')[1]; } // upload to imgur using jquery/CORS // https://developer.mozilla.org/En/HTTP_access_control $.ajax({ url: 'http://api.imgur.com/2/upload.json', type: 'POST', data: { type: 'base64', // get your key here, quick and fast http://imgur.com/register/api_anon key: '123', name: 'neon.jpg', title: 'test title', caption: 'test caption', image: image }, dataType: 'json' }).success(function(data) { window.location.href = data['upload']['links']['imgur_page']; }).error(function() { alert('Could not reach api.imgur.com. Sorry :('); window.close(); });
What I found here to upload an image in Imgur. I replaced "123" in the example above with my client ID, but the ajax response returns with the error "Invalid API key". I did not receive the API key, but the client identifier and client secret. I tried option 2, but still no luck. How to get this past problem with an API key? Also, the code above is deprecated because I think there is version 3 of the API, but it seems to only work with https and I don't have SSL on my site.
source share