Getting facebook profile picture - facebook

i need to get the facebook profile picture of anyone by passing their id. But i no need to use facebook API or Graph anything else.. Just i need to give the url with that id.. Is it possible to get the profile picture in this way? I tried in google but i didnt get it. If anyone knows this please respond me...

Well, I think the only options available are:
https://graph.facebook.com/[PROFILE_ID]/picture (You can include this URL inside a tag and it will work).
Scrap yourself the page corresponding to the profile, i.e. http://www.facebook.com/profile.php?id=[PROFILE_ID] and get the URL of the picture there.
I would suggest you to use the first one, because it gives you more flexibility about the picture size (?type=small, ?type=thumbnail, etc).
Edit
Keep in mind that this answer is from 2011, and Facebook makes changes in its APIs frequently.

Apart from using Graph API as already mentioned above (https://graph.facebook.com/[PROFILE_ID]/picture), there are a couple more ways:
FlipTop has a service that pulls up all sorts of information on Facebook users, including direct CDN URLs (e.g. https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/275588_504804917_147319_n.jpg) of profile pictures. (Link to API documentation)
Cloudinary has a similar service, but with hosting thrown in the mix. They do require you to open an account, but it's free. Then you can use their CDN URL format to link to any picture like this: http://res.cloudinary.com/[YOUR_ACCOUNT]/image/facebook/[PROFILE_ID].jpg (Read more here)

Related

facebook graph page/picture edge returning questionmark

So this is a little bit odd, I have a website that trawls facebook looking at specific pages and requesting data from them.
As part of this I request the picture object of the page: http://graph.facebook.com/285361880228/picture
This returns a question mark instead of the page profile picture.
Other links to pages seem to work without a problem.
http://graph.facebook.com/1485760851674064/picture
Does anyone know what may be causing this?
I am currently using version 2.3 of the API.
I'm assuming it has something to do with the page setup, as according to the facebook documentation,I should be able to read this.
https://developers.facebook.com/docs/graph-api/reference/v2.3/page/picture/
It seems like the facebook page has not been published. Try publishing the page and access the image using same link. It will work.

Share image including some attributes (e.g. description) on Facebook over web without app validation hassle

I want to share an image from a website on Facebook and pass some attributes (e.g. a description) to the status update, all done by clicking on a link.
A few months ago this worked fine using the sharer.php but by now this script just accepts a URL as parameter and scrapes the target site for Open Graph meta tags. This new approach isn't very helpfull if you just want to share elements on a page instead of the whole page.
Yeah, I could create an app and use the feed dialog to achieve my goal. But I honestly don't want to walk through the tedious app validation process just to share an image with some additional info!
So, does anyone know of a way to avoid this app hassle? Perhaps some undocumented parameters for the new implementation of the sharer.php?
There's no need for app validation - as #CBroe correctly stated! So the feed dialog IS an adequate solution!
Background: I assumed an app needs validation to go live. But I just didn't set up my app properly to make it available to every Facebook user.
See the comments to gloat over my stupidity. ;)

Creating a Facebook App

I am building a website for a client. He has a Facebook page for his business. On the homepage of his site, he wants a feed that will pull in all the updates from his business' Facebook page.
Now, I felt this would be very easy to implement (maybe it is) but I have scoured the Facebook API for any simple way to do this. I am having a lot of trouble understanding which way I should do this. I've settled on using JS to access it, but have no idea where to go from there.
Do I need to create an app? If so, which options do I select so I can access the clients facebook page?
How do I get my app that I've created to show up so a user can authorize it? I have so many questions, and Facebook isn't very good at giving me answers.
Any help is greatly appreciated.
I would suggest you just use the facebook page's RSS feed.
Example
Take his page URL e.g.
https://www.facebook.com/pages/Lazery-Attack/6001014870
Take the number at the end of the url off, and plug it into the facebook feeds URL e.g.
https://www.facebook.com/feeds/page.php?format=rss20&id=6001014870
Voila, you now have an RSS feed you can integrate into the website you are building.
URL Breakdown
The URL is broken down the following way:
https://www.facebook.com/feeds/page.php?format={feedFormat}&id={PageID}
Vaid feed formats are:
RSS - rss20
Atom - atom10
JSON - json
Other Examples
Atom
https://www.facebook.com/feeds/page.php?format=atom10&id=6001014870
JSON
https://www.facebook.com/feeds/page.php?format=json&id=6001014870
Take a look at the facebook API, right here: http://developers.facebook.com/docs/reference/api/page/
You can give it a try here:
http://developers.facebook.com/tools/explorer/?method=GET&path=19292868552%2Fposts
The like box: http://developers.facebook.com/docs/reference/plugins/like-box/ also has the latest posts available
The simplest way is to add a Like Button to the page and make sure "show Stream" is checked on as this will show all recent posts. You can customise the appearance also (e.g. width, height etc).
No App or messy API calls needed!
Try it out here and simply paste the resulting code into your webpage:
http://developers.facebook.com/docs/reference/plugins/like-box/
Not an app, but the Facebook Social Plugins over here at Facebook For Pages

How can I get a link to a Facebook or Twitter avatar by username?

How can I get a link to a Facebook or Twitter avatar by username?
For Facebook the image is publically availible and can be seen at: http://graph.facebook.com/username/picture
For example, here is mine: http://graph.facebook.com/totten/picture
You will notice that the url above actually gets forwarded to another caching url. Don't save the long url (http://profile.ak.fbcdn.net/....) save the short http://graph.facebook.com/ one. The other, longer url, could change and break.
If you want to display that url in a web page you just need to do the following:
<img src="//graph.facebook.com/totten/picture" />
Which gets you: http://graph.facebook.com/totten/picture
Thats it, no complicated API or authentication is needed.
For twitter you need to use the api: http://apiwiki.twitter.com/w/page/22554755/Twitter-REST-API-Method:-users%C2%A0show
you have to use facebook's graph API to get profile pictures. You'll have to register your app with facebook to get an API key, and then you can access most of the information on a given user's profile.check out their developer page to see some examples
Twitter just changed the way they handle API call. Looks like you'll have to register your app with them as well to get access to the avatars. I haven't used the twitter API since they changed it, so i'm not a sure about what goes on, but check out the docs page to read up on what you'd have to do.
hope this helps!
Some programming paradigms (Razor in ASP.NET or ASP.NET MVC 3, for example) have their own helpers to work with social media. If the paradigm you are programming in does not have helpers, you will have to access the FaceBook and/or Twitter APIs and use them to get the "avatar".
I have not played with Facebook, but the Twitter avatar link is provided on the user's profile, when you get it.
With regards twitter, I was able to get mine by visiting my profile page:
https://twitter.com/<USERNAME>
From there, you locate the <a> tag with the class ProfileAvatar-image and extract the href attribute. I was able to use that link on a separate site to import my avatar from Twitter.
I did all this manually, but it would be relatively easy to set up a script that used the username to request the profile page and isolate that link.

How to get a facebook profile picture under https?

Is it possible to get an facebook profile picture under https using the new Graph API?
We run a site under https, but the profile picture returned by the facebook Graph API is always served as http (when using https://graph.facebook.com/XXX/picture, the request is redirects to http:// ...). The result is the dreaded mixed-content message.
Anybody know of a workaround?
Here is the fix:
you need to the parameter: return_ssl_resources=true
example:
https://graph.facebook.com/FB_UID/picture?return_ssl_resources=true
Use link 1 to get a high resolution image, link 2 to get an icon sized image where 'xxxx' refer to 'facebook_user_id'.
link 1 :
https://graph.facebook.com/xxxx/picture?type=large
link 2 :
https://graph.facebook.com/xxxx/picture?type=small
The Graph API is essentially a very basic API, it's probably not the most efficient method to grab images. A better alternative is to learn how to uSe "FQL" and create a FQL that grabs all the UID's profile pictures. This way, instead of hundred and hundreds of calls, which can be very slow, you grab all the info you need in one call.