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.
Related
Has Facebook released any api for facebook cover photo?
I want to implement it using PHP language.
EDIT
I want to upload cover photo in facebook timeline using graph api PHP
There is an api for updating the cover photo on a page
http://developers.facebook.com/docs/reference/api/page/
It asks for a photo id which i guess is the id of a photo from the users album.
Actually, it is not possible to change the profile picture directly via Facebook Photo Graph API as no section mention about that.
However, we can do a trick by uploading user’s photo to Facebook via the API then redirect the user to uploaded photo URL with 1 added in querystring parameter as below:
http://www.facebook.com/photo.php?pid=xyz&id=abc&makeprofile=1
“&makeprofile=1″ is the main thing here and xyz/abc will be returned by Facebook. By adding the parameter, Facebook will auto change the profile picture of the current user with the uploaded picture above.
For more info:
http://4rapiddev.com/facebook-graph-api/php-change-facebook-profile-picture-with-graph-api/
You can upload photo to an album via graph api. Get the new photo id and redirect user to this url
"http://www.facebook.com/profile.php?preview_cover=" + photo_id
before that, you should inform the user that he/she will be redirected to facebook to page where they can set new cover photo (they need to confirm the change, click the save button). It's not perfect solution, and not fully covered api but it's best way out there asfaik.
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
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.
Here on my fanpage I've added my small app, that makes it possible, that fans can upload photos to a special photo album of this fanpage.
It's possible, cuz I use a fanpage admin permission ("manage_pages, publish_stream and offline_access").
But now - everytime someone uses this app, I get a photo publish news feed on my fanpage. How can I add a photo to a fanpage WITHOUT publish it to the newsstream?
Actually my publish php code looks like:
<?php
$post_data = array(
'image' => ('#' . realpath($photo)),
'message' => $msg)
);
$facebook->setAccessToken(_FANPAGE_ACCESS_TOKEN);
$data = $facebook->api('/'. _ALBUM_ID . '/photos', 'post', $post_data);
?>
When I remove the "publish_stream" permission with my fanpage admin account - there will appear a 'funny' bug. The uploaded photo won't show up in the photo album and not in the news stream. But it is in the photo-strip where you see all new photos and when you click on it, it will be in a row with all those uploaded photos... it looks like, that it is somewhere in a 'hidden' photoalbum.
So does anyone have a clue, how to post photos over the graph api without publish it to the news stream?
Thanks in advance,
Jurik
I got the solution! Nowhere in the docs is it mentioned - if you don't want post a feed when you upload a photo via Graph API set following parameter: no_story=1
This information was earlier here: http://developers.facebook.com/docs/reference/api/photo/
But somehow it disappeard from this doc. :(
source: Can I upload photos but not post to wall in Facebook?
How to contact FB so that they add this VERY important info?
You could delete the news feed stream post immediately after upload (if its not returned when you create it). If you call the graph api: https://graph.facebook.com/269434846409322/feed?access_token=... you can get a list of feed posts and then you could issue an HTTP DELETE to the item you want to delete, like https://graph.facebook.com/269434846409322_269690926383714.
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.