javascript - Sideloading images to imgur without API key -


i've been trying use feature of imgur api allows send request http://api.imgur.com/2/upload url in form data, , have image uploaded, can't work, returns nothing.

$.get("http://api.imgur.com/2/upload.json", {   url: 'http://upload.wikimedia.org/wikipedia/commons/3/3e/phalaenopsis_jpeg.png' }, function(data) {   return console.log(data); }); 

are there alternatives? or know how can above code work?

imgur api documentation here

ah, in fact working!

the location of uploaded image being returned location in response headers.

edit:

i found wasn't able access headers had come else. here's snippet upload using yql:

urltoimgur = (url, callback) ->   upload_url = "http://api.imgur.com/2/upload?url=#{url}"   $.ajax     url: 'http://query.yahooapis.com/v1/public/yql'     datatype: 'jsonp'     data:       q: "select none html url='#{upload_url}'"       diagnostics: true     success: (data) ->       redirects = data.query.diagnostics.redirect       image_url = redirects[redirects.length-1].content       callback image_url 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -