Obviously, the answer has changed a lot since you first asked the question, but here is the answer for today. Use the Facebook API to figure out how to get information about each photo in an album from Facebook:
https://graph.facebook.com/albumID/photos?fields=id,likes.summary(true),comments.summary(true)&after=XXXXXX&access_token=XXXXXX
Use Ajax to send a GET request:
$.ajax({ dataType: "json", method: "GET", url: "https://graph.facebook.com/" + albumID + "/photos", data: {fields: "id,likes.summary(true),comments.summary(true)", limit: 100, after: afterStr, access_token: token})
The variable 'afterStr' is the identifier of the next data page.
Then to count likes and comments we received from Facebook:
var dArr = msg.data; var i = 0; for (i = 0; i < dArr.length; i++) { like += dArr[i].likes.summary.total_count; comment += dArr[i].comments.summary.total_count; }
Send the result to your HTML using ID:
$("#likeID").html(like); $("#commentID").html(comment);
We work a demo here .
Hope this helps!
source share