Is it possible to make FB Application albums private by default? - php

I am uploading some photos by Graph API and I want to make my application album private by default so that it won't spam the news feed of other users. Or maybe there is an option for it to not post every upload on news feed?

Yes, you have privacy parameter. I haven't tested it with photos yet but it works fine with albums and posts. Pass the privacy object along with access_token or other fields.
http://developers.facebook.com/docs/reference/api/post/
See the privacy field in above link.

To upload photos without the corresponding news feed story, there's a no_story parameter you can include when uploading the photo
This is documented in the 'photos' part of the 'User' Graph API documentation

Related

Facebook Graph API - Pulling photos from tagged posts

I'm using the Facebook Graph API in PHP to pull tagged and uploaded photos from a user. We are currently using the /me/photos... endpoint to grab both kinds of photos. On our side, the code roughly looks like...
$api_call = $this->facebook->api("me/photos?date_format=U&since=$since_time&until=$current_time&limit=".$photo_limit);
// Valid response was received
if(isset($api_call['data'])){
// Get the photos the user is tagged in
$user_tagged_photos = $api_call['data'];
}
Variables in the URL string are just vars we set. We then just do the same thing for uploaded photos.
However, what my team has realized is that users also sometimes are tagged in posts that have associated pictures with them. So, maybe they are tagged in a post with a picture of them, but they aren't physically tagged in the photo.
Is there a method available for grabbing photos from posts a user is tagged in? The graph api reference for /post/ lists "picture" as a field but describes it as:
The picture scraped from any link included with the post.
Which is not what I want. I want the attached picture, just can't seem to find a way to access...
Thanks in advance for any help.
In that case, object_id in the Post object that gets returned when making a request to /{user-id}/tagged should be the ID of any photo/video that is attached to the post the user is tagged in.
Check the docs for the /post endpoint.

How to get album id and to upload image to fan page album

All available descriptions to upload an image to a fanpage use an album id, but
no one describes the format of the id and how to get it.
Are there examples of php code to get the album id of an album on a fanpage
and examples to upload an image to that page
Here are the steps you will need to build, using the graph api.
Get the facebook ID for the page.
Get an access_token from the page you want to upload to.
Make a form to POST to "https://graph.facebook.com/". $_userID . "/photos?access_token=". $_accessToken
The image will be uploaded to a folder with the same name as you app. So if your app is called "Magic Photo Uploader", the photos will go into a folder called "Magic Photo Uploader Photos"
In my experience you will not need an album ID, I think that documentation is outdated, since for all my apps it makes a album for those app photos and I cannot rename it. But there was once upon a facebook, a REST API that used to let you create and populate albums. Not sure if that is still accessible as a legacy.

facebook graph api getting only one picture in feeds

I am developing an app using the facebook graph api.
When I create an album with more than three pictures on facebook, on my wall post it displays three thumbnail images, but when I check in the feeds in the graph api, it only gives link to one image.
I checked out similar websites, and they also display three images like facebook not sure how to do this.
I think you are supposed to get the photos uploaded in a particular album,for that you can use
https://graph.facebook.com/facebook_d/albums
this will return all album details with album_id,using that album id you can fetch the photos in that album by
https://graph.facebook.com/album_id/photos.

facebook upload photo without news feed post? Possible?

Is it possible to use Graph API to upload photos to facebook without a news feed post?
use no_story=1 parameter in your photo upload.
from: https://developers.facebook.com/docs/reference/api/photo/
If you would like to suppress the
story that is automatically generated
in the user's feed when you publish a
photo (usually because you plan on
generating your own), you can add a
no_story=1 parameter. In this case,
the user will receive a notification
that your application has uploaded a
photo.
I guess you can bypass the post-if you upload the photo to the user's album, and then post your own news story to the user's album, for example "here is my new photo from XXXXXXX application" the profile will only show the news post, and the photo upload. Make Sure to first publish the photo, then publish the news story.

Facebook API/PHP - Is it possible to change a user's profile image via FB Graph API?

Is it possible to set/change a user's facebook profile image through the graph API?
I can't find a specific API method, but it is possible to upload an image to a user's album (http://developers.facebook.com/docs/reference/api/photo). Can I set the user's profile image to an image uploaded to their album?
Edit:
Same question asked in reference to REST API
Can I set a users profile image using the Facebook API?
No, And here's a comment from a guy at facebook:
The Original Link - you have to press show comments
We can do a trick by uploading user’s photo to Facebook via the API then redirect the user to uploaded photo URL with makeprofile=1 added to the list of query strings:
facebook.com/photo.php?pid=xyz&id=abc&makeprofile=1
Check Auto Change Facebook Profile Picture to get PHP example and demo.
Currently this is possible by redirecting the user to the mobile profile pic change url, https://m.facebook.com/photo.php?fbid=[fb photo id]&prof&ls=your_photo_permalink
The previous work around, using the facebook.com/photo.php?pid=[fb photo id]&makeprofile=1 url no longer works.
To the best of my knowledge and experience: No.
See the "Publishing" section here: http://developers.facebook.com/docs/reference/api/photo
Requires the publish_stream
permission.
To publish a photo, issue a POST
request with the photo file attachment
as multipart/form-data.
You can publish an individual photo to
a user profile with a POST to
http://graph.facebook.com/PROFILE_ID/photos
We automatically create an album for
your application if it does not
already exist. All photos from your
application will be published to the
same automatically created album.
You can publish a photo to a specific,
existing photo album with a POST to
http://graph.facebook.com/ALBUM_ID/photos.
The last sentence states you can publish to an existing album, so if you're trying to update the user's profile picture (not sure from the way you stated your question), try getting the album ID for the user, then publishing to that.

Categories