I'm doing a Facebook Graph API call for "me/home" to get the user's news feed. As everyone knows, the URL you get in the "picture" field is a low resolution photo that doesn't look good at anything above 100x100. I know you can get the URL to the high resolution picture by doing another graph call for the "object_id" and using the "source" field in that result.
But I was looking at the URLs and thought there might be a way to transform one into the other without having to make another graph call. Either that, or construct the high resolution one from existing data in other fields. For example, the first URL is the low resolution one, and the second URL is the source resolution.
http://photos-d.ak.fbcdn.net/hphotos-ak-ash4/297313_10152643117455790_610095553_s.jpg
http://sphotos-b.xx.fbcdn.net/hphotos-ash4/297313_10152643117455790_610095553_n.jpg
It looks like the numbers are (something I don't know)_("object_id")_(something else I don't know)
Has anyone had experience with trying to change out the URLs while still keeping the numerical section in the middle? Are there typically variations that could cause regex problems?
EDIT: Here is the code I'm using.
String objectId = null;
if (jsonObject.has("object_id")) {
objectId = jsonObject.getString("object_id");
}
String postPhoto = "http://graph.facebook.com/" + objectId + "/picture";
The check for if the post is a photo is a little earlier in the code, so it'll always run these lines for a post type of "photo".
Its a late response but but I have found a better approach
If you have got a address by using graph api like this
https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xaf1/t1.0-9/s130x130/10501892_701590943222768_782659935906208443_n.png
then just replace 130x130 to a valid resolution
https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xaf1/t1.0-9/s480x480/10501892_701590943222768_782659935906208443_n.png
and you will be able to get high resolution image
Valid image resolution can be found from this example call
http://graph.facebook.com/701586786556517
701586786556517 = object_id from Facebook graph API call
Hope this helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With