How to count photos on my FANPAGE wall? - facebook

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

Related

Facebook Graph API Sync Photo Album

I'm trying to sync a photo album to a facebook group album. When using a token as a user with moderator permissions I can view and post photos to the album using
GET https://graph.facebook.com/v3.2/{album_id}/photos
and
POST https://graph.facebook.com/v3.2/{album_id}/photos
However, when I go to delete photos I get:
"(#200) The permission(s) publish_actions are not available. It has been deprecated. If you want to provide a way for your app users to share content to Facebook, we encourage you to use our Sharing products instead."
With the recent changes to the api and removal of publish_actions is there anyway to delete photos in group albums? Or is there a better approach?

Facebook GraphAPI to retrieve all user profile images

I need to retrieve all user profile images by user id and access token using Facebook Graph API.
I can take all user's albums in this way: {user-id}/albums?fields=type
In this list I can see an album with type = profile.
Is possible to change my request to filter directly this album?
Are there an others methods to take all user's profile images (for example using a single FB request)
You can´t filter, you have to get all albums and browse through them in your code to find the profile album. After that, you just need to make another API call to /{album-id}/photos to get access to the photos.

How to fetch a user Facebook photo albums that I am not friends with

I want to create a FB app that fetches all of Andy's photo albums. Andy's photo albums are all set to be publicly viewable. Andy has 0 facebook friends.
With respect to FB permissions... How can I get all of Andy's photo albums to be fetched and displayed onto a public website? Visitors arriving to the website will NOT be friends with Andy ...and... will NOT do a facebook authentication upon arriving to the site.
Is this feasible? Is it possible to get ALL public photo albums from Andy without requiring permissions or being friends of Andy?
Is one possible solution to... have Andy to provide photo permissions and then do a cron job and store the FB response into a database for the website to fetch from?
Please let me know! Thanks
No, you can't fetch the albums/photos of a non-friend (even if some pictures of that user are public). This is not supported via the API.
You can just get the-
photos of the user : /me/photos with permission: user_photos
photos of the friends: /FRIEND_ID/photos with permission: friends_photos
current profile picture of any user xyz: /USER_ID/picture
The albums belonging to a Page, if they're public-visible /PAGE_ID/photos
(it seems that you want to create a dummy user, and fetch all the photos from thers, if so, point 4 could be useful to you)

Facebook graph api picture from file upload?

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

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.