I have a Facebook application in which a user can upload photos to a facebook fanpage. I am having trouble figuring out how to upload the photo as the user that is using the application. Currently I can have the fanpage upload the photo as itself, so the fanpage loses the author of the photo.
To do this I am grabbing the fan page's auth token(which I am assuming is the reason the app is posting as the fan page) and using that to pass to the "photos" method of the api. I am using the AS3 api, but I am sure the concept is the same no matter which api I am using.
var values:Object = {message:"message here", name:"title here"};
values.access_token = fanPageAccessToken;
values.image = file;
Facebook.api('fanPageId/photos/', handleUploadComplete, values,'POST');
When I change to the user's access token the image is uploaded to the user's photos. Even though I am specifying the fanPageId, it gets uploaded to the user's photos.
I am struggling here. Does anyone have an idea I can try, or some insight to share?
Thank you so much, I appreciate your time!
I've tried every possible API combination to post a photo to a page from the user, but it's no use. A user cannot post a photo to a page. Even creating an album on the page and then posting to that doesn't work.
Related
I was using FB api to post photos to my fanpage's news feed (http://www.facebook.com/MyApp/photos_stream), but from some time it stopped posting it to news feed and it just uploaded photos to some album (http://www.facebook.com/MyApp/photos).
This is the api command I was using before and after it was working, nothing has changed on my side.
$result = $facebook->api('/123456789/photos', 'post', $attrs);
So the question is, how to post photos to fanpage wall (timeline) properly and why it stopped working by itself?
Thanks
I had the same problem a few times ago.
In fact it was working but you have to go to your photo folder and accept the uploaded image.
In the album Facebook will show you a panel saying you have to approve those photos.
By doing this Facebook will publish the images on the timeline.
I know this is very annoying but I didn't find a better solution (I think Facebook has added a new security to avoid some abuses).
EDIT:
Look at the Facebook documentation.
You can post photos to a Page's Wall by issuing an HTTP POST request
to PAGE_ID/photos with the publish_stream and manage_pages permissions
and the following parameters.
Make sure you are using those two permissions and that your parameters are correct.
When I try to upload an image to a fan page managed by me, it gets uploaded to my album instead of the fan page's album.
I've given the 'manage_page' permission
And I've tried the following in the Graph Explorer Tool
The id I've given is my page's id. I've tried changing that to the album id in the page also (the album is having can_upload set to true).
But still the image is getting uploaded to my profile rather than the page. Can someone please help me ?
Ok. Finally I found the answer.
It seems there are two types of access_token. One is to manage the user and the other is to manage the page.
Normally the graph explorer shows the access_token to manage the user. To get the access_token to manage the page, we need to query that from "https://graph.facebook.com//accounts".
This would result like
Then, use that access_token to finally upload the image to your fan page as shown in pics in the question.
Hope this helps.
How to post a picture to a specific album in page from app without posting the image on page wall? Currently I can post picture to a specific album, but I don't want to see that on page wall becouse the app will post a lot of pictures. So how that is possible?
This is an example of app that uploads generated picture to specific album but dosn't publish it on its wall, I'm trying to do the same.
http://www.facebook.com/MercedesBenz?sk=app_318742408161371
Yes this is possible by providing no_story parameter equal to 1 while uploading photo.
POST https://graph.facebook.com/ALBUM_ID/photos?no_story=1
This information once was documented for photo object, but not anymore exists in current documentation.
This is described in Developer Blog post: Suppressing auto-generated feed stories when uploading photos
Current, I can upload a photo to an user's album. but I can't use the url of this photo(assemble the url by the photo id), it says:"FBCDN image is not allowed in stream", I also figured out that facebook forbid user to do this.
I know that I can upload the photo to somewhere else on the internet, but actually I don't have that 'somewhere', so how does everybody do ?
You dont need to assemble the url of the picture you just uploaded. Instead, use the photo_id that you got back and make another call to the Graph api :
https://graph.facebook.com/{PHOTO_ID}
The response from that call will contain all the information you need (including a link to the photo on facebook).
Is there any way to upload an image (UIImage) directly from an iPhone app to a user's wall/feed?
All the samples I see are either using a json-embedded link or they use the photos.upload call with album ID (aid) which results in the user getting the image in his photo album(s).
What I want to do is to upload an (UI)Image created (by the user) inside an iPhone app and upload to his/her wall. Is this possible? Sample code would be highly appreciated.
This isn't possible. To understand why, you have to consider the conceptual model that Facebook currently uses: Posts on a user's wall are just bits of text optionally attached to some link URL. That link URL can be some random image on the web, or it can just as well be an image that the user already has in their photo albums.
But a wall post cannot inherently "contain" an image in and of itself. Therefore you need to host the image somewhere, be it on your own site, or on Facebook itself, inside one of the user's albums by uploading it first to there.
I'm trying to figure out the same thing myself. One thing I did find out is that if you post the "Wall Photos" album they do get posted to the wall. However you only have a wall photos album if you've uploaded photos to your wall from your profile page before. And even then, you need to get the album aid and then post to it.
EDIT
Found a much better solution. First upload the photo to your default album, then make a post to the wall with the link to your photo that was returned when uploading (not a link to the image but the page the image is on).