Facebook graph api picture from file upload? - facebook

In the facebook graph api we have a attribute (picture) for attaching a image with a post. The source of the image has to be some location on the server. I have a file upload control on the page, can the uploaded image(not yet submitted) be used instead of images on the server?
I need to give the user an option to upload a image from his/her computer and that image will be posted on facebook using graph api. But since i don't have a path to the image, how would I do this?

From facebook documentation 'how to':
Publishing an Photo
In order to publish a photo to a user’s album, you must have the
publish_stream permission. With that granted, you can upload a photo
by issuing an HTTP POST request with the photo content and an optional
description to one these to Graph API connections:
https://graph.facebook.com/USER_ID/photos - The photo will be
published to an album created for your app. We automatically create an
album for your app if it does not already exist. All photos uploaded
this way will then be added to this same album.
...
Uploading a photo to your app’s album. Creating a new album and
uploading a photo to the album you create.
https://developers.facebook.com/blog/post/498/
Also, you may upload your photo with Graph method /me/photos

Related

How do you set a link for photos uploaded to your application album on Facebook?

With the graph API you can upload to an album specific to your application if you have publish_actions/publish_stream.
https://developers.facebook.com/blog/post/498/
What I want to know is how to create a link back to the original content, like in photos uploaded by Instagram, as shown here;
Is this a special integration with Instagram since they are owned by FB, or is it just an undocumented parameter?
Instagram's photo uploads are using the Open Graph APIs here, they're using action with an attached photo which links back to their site, I'm unsure if the 'View on Inastagram' link specifically is publicly available, but photo uploads that link back to the photo inside your own app are possible for any app, and are documented here

Upload photo to my facebook album

Is there a way to upload photos to my existing facebook album with the javascript SDK without any authorization ? For example, I know my facebook ID and the image URL what I want to upload.
Without authorization you cant upload images to an facebook album.
Take a look at this answer:
Facebook Graph API - upload photo using javascript on stackoverflow

How to count photos on my FANPAGE wall?

I gave an access to fans to upload photos to FANPAGEs wall. How can I count posted photots?
I am too young in FB.apis :-(
Thanks!
I've just read http://developers.facebook.com/docs/reference/api/photo/
An individual photo as represented in the Graph API.
To read the 'photo' object you need
any valid access_token if it is public
user_photos permission to access photos and albums uploaded by the user, and photos in which the user has been tagged
friends_photos permission to access friends' photos and photos in which the user's friends have been tagged
To publish a 'photo' object you need
a valid access token
publish_stream permission
With that granted, you can upload a photo by issuing an HTTP POST request with the photo content and an optional description to one these to Graph API connections:
https://graph.facebook.com/USER_ID/photos - The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.
https://graph.facebook.com/ALBUM_ID/photos - The photo will be published to a specific, existing photo album, represented by the ALBUM_ID. Regular albums have a size limit of 200 photos. Default application albums have a size limit of 1000 photos.
PAGE or APP creates OWN XLBUM which can access the same way: https://graph.facebook.com/ALBUM_ID/photos
But there is 1000 photos limitation!
Via the Graph API you can get the Photos connection off of the Page object.
See: http://developers.facebook.com/docs/reference/api/page/
You can play around here: http://developers.facebook.com/tools/explorer
Get /me/accounts
Click one of the page IDs that show up that has some photos.
Add /photos after the page ID and click Get /{pageId}/photos

Facebook photo sharing to friend's wall

I am developing a greeting card application. Greeting card should be posted to multiple friends' wall. I had used graph API to upload picture to friend's wall using [friends_Id]/photos post. Using this approach Facebook will create an album in to that user account automatically rather than creating or sharing photo to friends. After photo upload this newly created album will be shared to friends. This is not the option which I'm looking.
Facebook will use the same album for other photo uploads. Since album was shared to some friends, all previously shared friends will get notifications on their news feed for this new photo upload. So I omitted this approach.
Second I used posting image link to friend's feed. This time Facebook won't allow me to post image links with hosted on their server saying that FCDN images are not allowed in stream.
Hosting a server will be an expensive option for me.
Third I used photo tagging approach. This work well. But this is not the required option.
In Facebook website there is an option to share a photo in an album to my friends wall. Can I implement this approach using graph API? Is there any option to share an uploaded image to friend's wall using graph API?
I hope that my question is clear to you... Please help.. :)
Perhaps this approach will work you. See https://developers.facebook.com/blog/post/526/ where you can post to a wall and refer to an existing photo, or basically attach a photo you own to a friend's wall. So here are the steps:
1) Upload the photo you are interested in sharing to your album. Note the photo ID.
2) Send an HTTP POST to https://graph.facebook.com/[FRIEND_ID]/feed with the object_attachment parameter set to your photo ID.
Please note that you will need an access token with publish_stream permission.

Uploading photo as a user profile's photo from Facebook Application

Is it possible for a Facebook App to submit a photo (with user's permission) as a profile photo?
Yes see here it even contains sample PHP code to get you started