Uploading image to facebook fan page fails - facebook

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.

Related

Facebook Sharing plugin doesn’t detect the specified post URL

I use Facebook share button to share my article (Title, description and image) on Facebook using Open Graph Meta and other default Meta
And my articles are echoed in post.php page like (mywebsite.com/post.php?id=post_id) which contents differ through post_id.
Well, while sharing a post on fb, facing some problems.
1: fb share doesn't detect the image belonging to the article/current post that is shared. (Thought the image URL in my Open Graph Meta is correct) and after sharing it on Facebook the link doesn’t redirect to the exact URL (mywebsite.com/post.php?id=post_id).
2: the fb share button is in my post.php page which shares different posts but sharing is counted same for all posts.
The FB share button has got an attribute (data-href="url-to-share") which my one is (data-href="<?php echo'post.php?id=post_id';?>").
Anyone know what and where is wrong with my code/URL addressing?
If your meta tags shows correct data then must be fb issue. I faced similar problem before.
Try debug your url in the FB debugger( https://developers.facebook.com/tools/debug/og/object/ ). It helps.
Fb haven't grab your updated data because they have their own time/interval to grab new data from the website(if im not mistaken). Using the debugger u'll see how the share will look like and show missing details if any.

Get all photos of a page using Facebook API

I am new to Facebook API but I have to get all photos from a Facebook page. I managed to get a graph api query that returns all pictures of only the first ever created album on the page which is the profile picture album. For example:
https://graph.facebook.com/227843870675663/photos
But I need to do the same for all other existing albums in the page. Any pointers are really appreciated.
Try this and let me know how it goes for you. I've successfully pulled all photos from a Facebook page.
Ensure that you are an Admin of the Facebook Page.
Go to:
http://developers.facebook.com/tools/explorer
In the API Navigator, you can access /me to bring up the basic information of yourself.
Try typing in /me/accounts to see if you can see anything. It should give you an error.
You need to enable certain permissions to make this Graph query. Choose the relevant permissions in the right sidebar. According to this doc you need the pages_show_list and pages_read_engagement permissions for this query.
Click on "Get Access Token" which will give you a new token with the updated permissions. You may get a popup window where you have to confirm which page(s) you would like this access token to be able to see.
Now try /me/accounts again. You should see a list of pages that you enabled access for, inside the viewing window.
Find the Facebook Page you want to query, and click on the "id" field. This ID is needed for making any queries related to this page.
Next, on the left window, you can see "Node: " and a + sign. Click on the + sign to see what options you have.
Click on the + sign and scroll down to "connections" and select "Albums"
The child-level, select "Photos"
The "Photos" child-level, select "source"
Now click "Submit" on the right hand side.
If the above doesn't work, you can try copying the following URL into the API explorer:
YOUR_PAGE_ID/?fields=albums.fields(photos.fields(source))
You will see a JSON returned with the URL of some/all of the photos in your selected Facebook Page.
Click "Get Code" and it will show you the Javascript or raw URL used to access this information.
The "cURL" tab will show the URL which will look something like this:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID?fields=albums.fields(photos.fields(source))&access_token=YOUR_ACCESS_TOKEN_HERE
You can copy that URL and plug it into your browser. You should see a JSON of all your photos, and each photo's corresponding URL on Facebook's CDN.
Getting photos posted to the feed, not just photo albums
To do that, you need to run a slightly different query:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID/feed?fields=attachments
Getting high resolution imagery
Many of the image URLs provided by the queries above will only provide resolutions up to 720px. If you want higher resolution images, then you need to find the target.id for each subattachment, and perform a separate graph query for each image to obtain the other resolutions. It looks like this:
https://graph.facebook.com/v15.0/YOUR_IMAGE_ID?fields=images
Watch out for expiring tokens
The token generated above will only work for approximately 1-2 hours. If you want a longer lasting token, follow the steps in this post here.
When you get your Facebook user, you can:
get the list of all its
albums
get the user's profile
picture
get the
photos
the user (or friend) is tagged in
They respectively need those permissions:
user_photos or friends_photos
not needed
user_photos or friends_photos
UPDATE:
If you want to get those information from a Facebook page:
Photos - The Page's uploaded photos.
Albums -
The photo albums the Page has uploaded.
Permissions are: any valid access_token or user access_token

Facebook photo feed

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.

Upload photo to fanpage from application user

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.

facebook like not get the required image

I am creating a facebook like to put on my site. This component will read all posts from a specific page`s wall and display them.
I want to get the required image post on my wall when any user like my page from my website.. I have multiple facebook likes on my page ..
My problem is that when a user like any of the like button it get any image from my page and post it my wall . But i want that it get the specific image and post to my wall..
i also tried to put og:image But no success :-(
Any suggestions please.
You haven't given enough code to diagnose your problems, but assuming that you've followed the open graph instructions on the Facebook Developers site - http://developers.facebook.com/docs/opengraph/ - It would be a good idea pass your target URL through the Facebook Debugger (formerly the URL Linter) it will help show you any errors you have regarding your open graph tagging implementation:
http://developers.facebook.com/tools/debug