简体   繁体   English

检索我上传的facebook照片

[英]Retrieve facebook photos uploaded by me

Is there any ways to retrieve facebook photos uploaded by myself only? 有什么方法可以找回我自己上传的Facebook照片吗? I don't need to retrieve photos that are uploaded by others. 我不需要检索别人上传的照片。

photos = facebookClient.fetchConnection("me/photos", Photo.class);
List<com.restfb.types.Photo> photosList = photos.getData();

I am doing it for my jsp page and using RestFB library. 我正在为我的jsp页面使用RestFB库。

Use FQL to get only your photos: 使用FQL仅获取照片:

String query = 
"SELECT pid, src, src_small, src_big, caption FROM photo WHERE owner=" + yourUid;

List<JsonObject> queryResults = 
facebookClient.executeFqlQuery(query, JsonObject.class);

for(int i=0; i<queryResults.size(); i++)
{
    String photoUrl = queryResults.get(i).getString("src"); 
    // add your code to use photoUrl
}

And the you can iterate through queryResults to get src for each image. 并且您可以遍历queryResults以获得每个图像的src。

You can use me/photos/uploaded , which does exactly what you want. 您可以使用me/photos/uploaded来实现您想要的功能。 https://developers.facebook.com/docs/graph-api/reference/v2.1/user/photos/ https://developers.facebook.com/docs/graph-api/reference/v2.1/user/photos/

photos = facebookClient.fetchConnection("me/photos/uploaded", Photo.class);     
List<com.restfb.types.Photo> photosList = photos.getData();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM