I'm trying to get the logged in user's profile picture for a canvas app, but I would like to have it in a specific size.
Is this possible and, if so, how?
Currently I'm using the following:
graph.facebook.com/{user's FB ID}/picture?type=square
This gives me a 50px by 50px image. There are also options to use type=normal and type=large to give large image size, but these are not square images, and also not the exact size I am looking for.
To be specific, is there a way to get a member's profile picture in size 80px by 80px directly from Facebook, without downloading a larger image and downsizing/cropping on my end?
You can use width/height as parameter:
graph.facebook.com/{user's FB ID}/picture?width=100&height=100
Just keep in mind that you may not get exact sizes, but very close ones.
Getting a bigger facebook profile picture via facebook php sdk, this worked for me:
$response = $fb->get('/me?fields=picture.width(400).height(400)', getenv('FACEBOOK_ACCESS_TOKEN'));
in 2019!
https://graph.facebook.com/[[[[insertusersfbid]]]]/picture?type=large
Is what i fall back to...
https://graph.facebook.com/[[[[insertusersfbid]]]]/picture?width=2000&height=2000
Is when i want to muck with the image.
If the user does not have an uploaded profilepicture; now fb returns the gender based default pic...
I hope this helps someone else :)
Related
I'm trying to get number of likes on videos. So I go like
https://graph.facebook.com/v4.0/{video_id}/likes?access_token={token}.
However I always get back empty data even if video has at least some likes.
I've created a token with following permissions: scope="public_profile,email,user_videos,manage_pages,user_likes".
The last thing to mention is that the video is posted by user page. I've also tested the same thing on Graph API Explorer and it doesn't even work there.
I for example can get comments on the same video...
The individual likes are likely not available to your app due to privacy concerns (the liking user would probably have to grant your app access to access their made likes first)
But since you are only interested in the overall number, asking for the summary should do it:
/{video_id}/likes?summary=1
or when using field expansion syntax,
/{video_id}?fields=likes.summary(1)
Per https://developers.google.com/photos/library/guides/access-media-items I am expecting that if I take mediaItem.baseUrl for an image, tack on =d to the end, and authorize the request, then i'll get back the media item's original bytes. This works as documented, good.
Per the same page, I am expecting that if I take mediaItem.baseUrl for an image, tack on =w375-h1135, and authorize the request, then I'll get back the media item's bytes after it has been resized using the specified width and height. Instead I get a 404.
Does specifying the resizing width/height only work for some cases? Makes it pretty useless to me if so... Anyone got the resizing to work? thanks
Turns out I was sending =w375.0-h1135.0 - as soon as I removed the .0 it worked.
Using the FB debug tool for http://www.talkjesus.com
https://developers.facebook.com/tools/debug/og/object/
I fetch new scape info without a problem, except one last thing that just won't kick in. The op:graph image shows default Xenforo pic instead of mine. However, the weird thing is if you click the link, it'll actually show my version (chat icon with 3 people group). It still pulls old XF pic too if I try to post on FB. I've confirmed with XF support it's not them, obviously anyway.
Any idea?
Your correct image is at the following URL...
http://www.talkjesus.com/styles/default/xenforo/logo.og.png
The image Facebook displaying on the Facebook Debug page is a cached copy of your old image. The URL for that image is...
https://fbexternal-a.akamaihd.net/safe_image.php?d=AQBAyXWZeLwaPVbO&url=http%3A%2F%2Fwww.talkjesus.com%2Fstyles%2Fdefault%2Fxenforo%2Flogo.og.png
The good news is this image caching should not have any effect on how your page is shared on Facebook.
If it does cause problems renaming your image and updating the OG tag will fix it.
We added Facebook Open Graph tags to our site NowGamer.com a few months back and everything worked perfectly initially. But in the last few weeks we've noticed that on about 2/3 of images the og:image would not display when an item was shared or liked. Sometimes going to the linter would scrape the page and the image would then be available.
But in other instances the image thumnbnail doesn't appear in the linter - although the link to the full image displays it at full size OK.
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.nowgamer.com%2Fnews%2F1298151%2Fassassins_creed_3_join_or_die_freedom_collectors_editions_details.html
The images all fit within the 3:1 parameters although they are relatively large (they have to be as they are screenshots for video games). Here is an example of exactly the same type and size of image that does display in the Linter and on shares/Likes
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.nowgamer.com%2Fps3%2Fps3-reviews%2F1293635%2Fresident_evil_operation_raccoon_city_review.html
I can't see why one works and the other doesn't. Any suggestions?
The thumbnail's width AND height must be at least 50 pixels, and
cannot exceed 130x110 pixels.
http://developers.facebook.com/docs/share/
Strange: I would have gone with a cache problem which I've also experienced before. For pure testing purposes if you want to attempt to refresh a different version of the URL try adding ?v=1 or some other parameter which makes the URL unique. This forces Facebook to go and get the URL again so you can make sure the images are working as expected.I think YouTube have also had this problem over the last few months http://groups.google.com/a/googleproductforums.com/forum/#!category-topic/youtube/sharing-and-connecting-on-youtube/YnTqofAhcN8
could you please point c++ code example to display videos and images thumbnails in listview?
I can help with images, but not videos:
http://www.codeproject.com/KB/GDI-plus/GdiPThumbnailsViewer.aspx
Basically you use a normal list control and add the images to an associated image list. There are some gotchas though - looks like you have to use the CImageView::ReplaceImage instead of CImageView::AddImage, else the images don't appear correctly. Masking the image may also require some work.