javascript - How can I get the image source (url) based on facebook image id using Facebook API for JS -


so got website make user log-in app, , he/she able access photos within page , edit them.

the way albums this:

fb.api(   "/me/albums",      function (response) {         if (response && !response.error) {           ...         }      } ); 

then after getting list of album ids, iterate through them respective photos doing:

fb.api(   "/"+albumid+"/photos",      function (response) {         if (response && !response.error) {           ...         }      } ); 

this return array of objects containing image ids.

i thought using fb.api("/imageid", function(){}) returns same image object id.

i want image source/full path add them inside html img tag. i'm still having problems it.

i saw there way of doing getting "json" url:

http://graph.facebook.com/"+photoid 

but throws me authentication error example if try using ajax (might because ajax doesn't contain authentication fb object does)

how can result ?

thanks in advance.

so after getting documentation links @cbroe, found doing this

fb.api(     "/"+photoid, {"fields" : "images"},     function (response) {          if (response && !response.error) {              console.log(response)          }     } ); 

by sending field "images", return absolute paths different sizes of specific image.

if want 100x100px thumbnail, can pass "picture" field.


Comments