Fetch custom size Facebook profile picture - facebook

I would like to retrieve a Facebook user's profile picture, but at a custom size (e.g.: 40px x 40px). Is this possible, or only the default values (normal, square, small and large) are fetchable?

Only those three values are valid from the API. For a 40x40 image though, you can easily resize the 50x50 (square) image.
Per this blog post it's now possible to get custom profile picture sizes:
The blog post was deleted, but it's still possible to get a custom profile picture size using the following parameters:
https://graph.facebook.com/<ID>/picture?width=<width>&height=<height>

Only normal, square, small, and large are available, but if you are putting them on a website you can put it into a fixed size div to clip it, or you can download the image programmatically and re-size it yourself.

Related

Facebook API full_picture is cropped, how to get a non-cropped version?

Using the Facebook API Graph Tool and trying to retrieve a full size image that is larger than 720 it gets cropped to a square.
This is the image for use in the Facebook graph API tool using version v2.12:
127495184638742_166955060692754?fields=full_picture,picture,link
How can I get back a full version of the image? Scaled is ok, just need the full image.
The docs that reference 'full_picture' are here:
https://developers.facebook.com/docs/graph-api/reference/v2.12/post
They say:
URL to a full-sized version of the Photo published in the Post or scraped from a link in the Post. If the photo's largest dimension exceeds 720 pixels, it will be resized, with the largest dimension set to 720.
But do not outline how to change the square cropping that is being applied.
the cropped version of the image
If it's an 'event' type, then you can get the full image if you take the object_id and use it in a separate facebook call to:
(object_id)?fields=cover,place,start_time,end_time
and the cover url will contain the full image.
Hit photo_id/?fields=images in graph api. This will return a set of different size images. Use the high resolution one.
For full reference: https://developers.facebook.com/docs/graph-api/reference/photo/

Facebook canvas app details page not accepting my resized image for the banner

I've used a resizing program to resize my image to the requisite 100 by 155 pixel dimensions for the banner image; but when I upload it I get an error message saying there's something wrong with the dimensions. The image I'm uploading is a stock photo I've purchased and have full rights to, meaning it's not home made. Any idea what else the problem could be. The program im using is pretty old and standard. Is there a specific one that can be recommended that is straightforward and won't give me an error on the facebook details page?
Sorry for misunderstanding,
Check out these instructions here:
https://developers.facebook.com/docs/guides/appcenter/#uploading
Especially those:
Don't put logos and text against the border of images.
Make sure banner images fill out the frame completely (and that they leave no white space, no rounded edges or no borders).
Round the edges of icons. We recommend that you use transparency and PNG, not GIF.
If your problem persist, Try another program. Personally, I use Adobe photoshop (Actions) to generate all graphics for my facebook apps, also there's tons of other programs that can help.
If you mean facebook cover Photo by banner image then the optimal size for it is 851px by 315px.
Here you'll find a quick Reference for Facebook Timeline Image Sizes:
http://laurenproctor32.com/tag/facebook-image-size/
Have a nice day.

How can I acheive a full-sized image in open graph?

I am using the facebook plugin on my wordpress website. My posts are image-only. I am able get the open graph functionality to work, however the image is either a tiny thumbnail with a useless excerpt box beside it, or full-sized with half of it cut of because of the useless caption box.
Now, I say useless, but I wouldn't mind having only my url presented below the image if possible, but without all the extra space. It looks terrible. Also, My image posts do not have titles so in the excerpts box the only title option without a separator for the "collection" theme I am using is sitenameonly....which leave my
sitename
site url
< .........huge extra excerpt space..............................................................................................................................................................................................................................................................................................................................................................>
I have looked elsewhere, in fact all over but can't find information to:
make images full-sized (as if they were posted directly to facebook)
Remove extra space in the excerpt box, leaving only the url
(or remove the box entirely--leaving a full-sized image)
thanks so much in advance
As long as your Wordpress plugin assigns a proper image to each post using the og:image tag and the conditions stated below (emphasis added) then you should be able to get full size posts.
We've increased the size of images in link page posts by 4x on mobile
and 8x on desktop to help you drive better fan engagement. As part of
this change, we've also made the aspect ratios for images consistent
across mobile and desktop. We recommend the following steps to
optimize your images for this new format:
Use images that are 1200 x 630px or greater for the best display on high-resolution devices. At the minimum you should use images that are
600 x 315px to display link page posts with larger images.
Use images that have an aspect ratio of 1.91:1. Try to keep your images as close to this aspect ratio as possible to avoid any cropping
in News Feed.
Use the og:image tag to choose the image that you want to share. If you don't use the og:image tag, users can choose the image they want
to post, giving them a chance to select an image that is poor quality.
Source: Larger Images for Link Page Posts

Get facebook gallery image thumbnails 206px

I'm looking to replicate the square thumbnails from facebook's current gallery. They appear to use images 206 pixels on the shortest edge. Then by setting them as the background image (centered horizontally and vertically) they essentially crop any excess off.
Could you assist me with an example fql query?
Hopefully i'm missing something obvious but can't seem to do it from src_small or src_big in photo table.
I managed to figure it out :)
I get the src_big url from photo then simply take the filename and append to https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash3/p206x206/
Not sure if it's a "real" solution but it's certainly working at the moment!
http://new.tickett.net/portfolio.php
Screenshot as site is currently in development and may change...
You don't even really need FQL. If you have a User ID, the image you are looking for is:
https://graph.facebook.com/USERID/picture?type=square&width=206
Here is mine using the same request:
You can see where this came from on the Graph API User object /picture connection reference where it is described as:
HTTP 302 redirect to URL of the user's profile picture (use ?type=square | small | normal | large to request a different photo). If you specify ?redirect=false, this connection will return the URL of the profile picture without a 302 redirect. Additionally, you can specify width and height URL parameters to request a picture of a specific size. This will return an available profile picture closest to the requested size and requested aspect ratio. If only width or height is specified, we will return a picture whose width or height is closest to the requested size, respectively; if width=height, we will always return a square picture.

Graph API get photo square (100x100)

How can I get facebook photo with selection view user set (if they use large image). If I use type = "large" or "normal" or "small" in path graph then I get image but It's not square and It's not selection view of user set. So, how can I get photo with square type and it's view of user set
You can get a square picture of higher dimensions than the normal one for type=square (which will be only 50x50 pixels in size) by requesting a picture with widthand height parameters set.
See https://developers.facebook.com/docs/reference/api/user/, “picture” connection, quote:
“Additionally, you can specify width and height URL parameters to request a picture of a specific size. This will return an available profile picture closest to the requested size and requested aspect ratio. […] if width=height, we will always return a square picture.”
Example:
https://graph.facebook.com/4/picture?type=square – Mr Zuckerberg’s “normal” square profile pic, size 50x50
https://graph.facebook.com/4/picture?width=100&height=100 – 100x100 pixels, perfect match for requested size
https://graph.facebook.com/4/picture?width=150&height=150 – asking for 150x150, getting 156x156 instead.
If you can live with maybe sometimes getting images that might be a little bigger (or smaller) then the requested size, you should be fine.
Otherwise it’ll take some testing to try and figure out if there are certain square image sizes that Facebook will always have “in stock” and deliver exact matches for, or if it might differ for every user depending on the picture they uploaded.
[[[FBSDKGraphRequest alloc] initWithGraphPath:#"me" parameters:#{ #"fields" : #"id,name,picture.width(100).height(100)"}]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
}
instead of 100 you can put 200 ,300 encrypt the response and get it with key
Try using the type square. As follows:
http://graph.facebook.com/[user_id]/picture?type=square
The square size is limited to 50x50. If you want a large size, you will have to enlarge the square version or crop the large version.
If you don't mind retrieving and cropping an image yourself, follow my tutorial here for code to do exactly that. It will let you generate square images larger than 50px.
This worked for me. Check the following query,
NSString * graphPath = [NSString stringWithFormat:#"%#?fields=photos.fields(id,link,source)", albumID];
Get the photo by querying for the user's profile data using FQL. In your case you shouldn't need any access token. There is a column called pic_crop which is an object that contains the uri you need:
The URL to the largest-sized square profile picture for the object
being queried. width, height: the pixel dimensions of this picture.
left, top, right, bottom: the pixel co-ordinates of the user selected
crop for this profile picture.
Use the Graph API Explorer for testing your query.
Update: From the Facebook Query Language (FQL) Reference:
Version 2.0 of the Facebook Platform API is the last version where FQL will be available. Versions after 2.0 will not support FQL. Please migrate your applications to use Graph API instead of FQL. Please see our changelog for current version information.