Howto select image from facebook - facebook

On my website there is possible post image from computer. But I would like also provide user to post image from facebook user album. I can imagine some dialog like "Facebook login" which will open faceook images and provide user to send image from facebook to my application. Does something like that possible? Many thanks

Yes, it is possible.
I assume you have a little experience with facebook api.
trigger login FB login window and request user_photos permission
make a query to facebook to get (all/random/a few) user albums like so me/albums?fields=id,count
If a key count is set, there are photos
(I would collect all IDs of albums containing photos and make a query to facebook with ech one ID)
Then again, query to facebook like so /%album-id%?fields=photos.fields(images)
Now you have an array of URLs of images which, for example you show to a user and after he selects, you download it and upload to your server
Since you did not request a solid code, I will provide you with at least with a little snippet, or show an illustration how to do that. http://paste2.org/hvGkngIL. (a metod index) (Might not work properly, since I cut it from a PHP framework I work with)

Related

How to get the facebook user id that likes my website (not a facebook site)

I am making a raffle within the people that had make an "I like" to a certain article of my external website (non facebook). In order to choose the winner I need to know who has made the I like.
This query:
https://api.facebook.com/method/fql.query?query=select%20like_count%20from%20link_stat%20where%20url='myWEBSITE'&format=json
Only get me the total count of I Likes but not the users ID
This query is perfect:
https://api.facebook.com/method/fql.query?query=SELECT%20user_id%20FROM%20like%20WHERE%20object_id%3D%MY_object_ID&access_token=MY_ACCESS_TOKEN
But how do I get an OBJECTID for an external url??
Thanks in advance
Object can be any thing like video, note, link, photo, or album but can not be any FB page or Url.. So I guess its not possible to get the user Id for a URL.
If you are using JS SDK / Like plugin in your website to like it, i think you can subscribe to an event and then use some ajax calls to get those userIds whenever they instantly like it.
See Somnath Muluk's answer in https://stackoverflow.com/a/13467793/269521

Like button for Facebook page shows generic Facebook description in News Feed

I want a Like button on my web site that Likes my Facebook profile (rather than my web page), so that when a user clicks it they subscribe to my Facebook posts.
I've created the Like button using the tool at https://developers.facebook.com/docs/reference/plugins/like/
Further down that page there is an FAQ entry:
Can I link the Like button to my Facebook page?
Yes. Simply specify the URL of your Facebook page in the href
parameter of the button.
So, I've edited the href parameter to point to my Facebook page. eg:
https://www.facebook.com/myfacebookid
When a user clicks the Like button it has the desired effect. The user ends up having Liked my Facebook page. This is easily verified by the user going to my Facebook profile and checking that the Like button has changed to Liked.
But. When the user clicks the Like button, and entry appears in their News Feed with a generic Facebook description. ie:
Facebook is a social utility that connects people with friends and
others who work, study and live around them. People use Facebook to
keep up with friends, upload an unlimited number of photos, post links
and videos, and learn more about the people they meet.
I don't want a generic post about Facebook to appear. I want the description to relate to my Facebook account and/or web site.
Normally, I could modify this behavior with the Opengraph og: description tag, but as the page in the href is a Facebook page and not my own, I can't control the Opengraph tags.
I'm pretty sure that this was working okay before I enabled timeline for my account, so maybe this is a timeline bug?
So, how do I add a Like button which a) Likes my Facebook profile rather than one of my own web pages, and b) Posts a description of my Facebook profile rather than give a generic Facbook description?
Are all your fields in the info part of your page filled in, and/or completed? I just tested your theory and it seemed to work as expected, only thing is I know all fields in "info" are filled it. Give that a try.
This may happen if you have filled invalid/incomplete/wrong og tags in past and later changed them. Facebook's cache creates problem sometime.
Try putting all the entries (i.e. all og tags) and then debug them here http://developers.facebook.com/tools/debug. This debugger gives a detailed info about the url with og tags and also clears the cache for you.
This should solve the problem.
You have 3 important fields that used on page opengraph: Name,Description,Profile Image.
They are used when some one post your link on Facebook, or Google or some else web service that handle opengraph.
Actually, the suggested answers currently do not work and there is an open bug / ticket on Facebook for it. Up to now, there's no fix.
The problem is that you can not use simply https://www.facebook.com/myfacebookid. You should copy and paste the exact page URL. If you have a low number of likes it would look something like https://www.facebook.com/pages/[YourPageName]/[Your page Id]/, and this is the URL that you should use at this point.
If it does not work, try also https://www.facebook.com/[YourPageName]/[Your page Id]/.
In short, copy-paste the URL, do not type it manually.

Adding Facebook Photo objects to Open Graph Action

I've created a timeline app that adds events to user's timelines in the past. I've noticed its simple to add tags, places, and external images to OG objects and actions.
However, I can't seem to find a good way to connect to a facebook photo (i.e. a photo from the user's albums). Adding a link to the photo's picture in the images field doesn't work the expected way without an access token (which will presumably expire)
For example: /namespace:action?image=http://graph.facebook.com/10100111692798728/picture will show a '?' photo (in aggregations and elsewhere) unless you pass a valid access token in too (that can't work permanently). This is presumably because whatever identity is going out to request the photo is not allowed to access it this way.
It doesn't seem like you can connect your own actions to photo objects either. Is there a solution to this that I've missed. I'd really like user's to be able to add a photo from their facebook albums to an action from my app (i.e. them doing the 'action'). It would be nice if you didn't have to point directly at an image on FB's CDN somewhere, it would be even nicer if there was a way to point directly at the FB open graph object.
Thanks,
Grant
It is possible to connect the action with Facebook photo like this:
POST /me/do:action?object=[objectId]&access_token=[valid access token]
If the [objectId] is an object id of existing photo - it will show the picture and correct link to the full size facebook photo on timeline.

Like an object on Facebook outside Facebook

I've been trying to use the Like button generator to get a Like button for some content on my fan page: http://www.facebook.com/photo.php?fbid=363385833679921&set=a.314588171893021.85085.305618229456682&type=1
What I want to do is show the likes this photo got on Facebook in the like button on my site and vice versa.
This seems to work for the actual fan page url but doesn't work for individual photos (haven't tested other objects).
You are able to see the likes the object on Facebook got through the graph API call: http://graph.facebook.com/363385833679921. So shouldn't that be available on non-Facebook sites as well?
Anyone know a solution to this without having to make a custom handler to show and post likes on site?
Why don't you just use the API to read the comments and likes on the object? Any user's access token will work if that user can see the object

How to show the images of friends who are using an app (code)

I am developing an application on facebook. My application also has an registration page. When a new user enters into our application I want the application to show the images of all his friends who are using this app. How do I accomplish this?
The solution to this problem requires that you use a Facebook Social Plugin.
You can't build your own registration form and show a user all his/her friends who are using your application before the user installs your application. This is because, in order to get a list of the user's friends, you have to have a valid access token - as this isn't public information.
There are 2 different social plugins you can use.
The simple "login" button which looks like the Facebook login button. (documentation here: http://developers.facebook.com/docs/reference/plugins/login/)
A registration form, which uses their users' Facebook profile to pre-populate some fields. You can also add fields to the form to get more information. (documentation here: http://developers.facebook.com/docs/plugins/registration/)
Both of these show the user pictures of the friends that are already connected/installed, and this is pretty much the only way you can pull this off before the user authorizes your application.
edit 5/20/2011
After browsing around the FB Social Plugin docs, I found another Social Plugin that you could possibly use if you didn't want to use the Facebook Registration Social Plugin. You can use the Facepile Plugin. This shows all the users' friends who have connected to your app, or page, or whatever you want..so you could build your own registration form and use this social plugin to achieve the friends photos result you were looking for.
I guess I see two solutions :
Simple, put a facebook like button "with faces" somewhere on your page, your users will then see the pictures of their friends who "liked" your page.
The option for showing friends pictures is show_faces="true"
Second option, that is a bit more difficult :
When a new user registers :
Save it's Facebook ID in a DB.
Get it's friend list using something like : https://graph.facebook.com/me/friends?access_token=...
Parse the returned JSON of its friends, and then compare with all the Facebook ID's you already have in your DB, you can find which friends are already in your systems, those are the friends you want to display, to get their pictures just use <img src="http://graph.facebook.com/USER_FACEBOOK_ID/picture?type=small"></img>
See more about getting friends of a user here : read about the "friends" connection.
the best way is to use facepile you need to add data-app-id and don't add data-href because if you will add data-href then system will check that url not your app so the facepile
div will look like this:
<div class="fb-facepile" data-app-id="YOUR_APP_ID" data-max-rows="1" data-colorscheme="light" data-size="small" data-show-count="true"></div>