Above my wall I have an option 'add photo'. Using it requires uploading an image, and results in creating new photo ('wall photos' album) and new post on my wall feed.
Now I have a JPEG image, and I know the correct URL pointing to it, and I would like to simulate that feature using that image as photo.
So is it possible to push a 开发者_StackOverflowJPEG file to album 'wall posts' and on the wall-feed, so it reasults in same way with the JavaScript SDK?
Edit
I want to post on an authorized user's wall, to be more specific. I have seen in documentation, that I can create an HTML form with the proper action, and let users upload images from the hard drive through it. But I don't want that. I have a JPEG file prepared already to be uploaded on behalf of the user, on the user's wall.
From what I understand you wish to publish a photo on the Facebook page wall. To do that you need to upload that photo in the 'Wall photos' album on your page. The name might be translated, but if you have only one page, just replace it with that name. First you need an id of that album. If you want to do this on multiple pages you don't know, you can find it by querying the Graph Graph API object PAGE_ID/albums which returns all albums by name and id and going through the data to find that album, or through an FQL query. If you have a single page you can just insert it manually. This album has no photo limit, so that ID is never going to change.
https://www.facebook.com/media/set/?set=a.**195193573720**.126782.20528438720
So you need to insert the image in that album to simulate it being uploaded from the page wall. Here is the part where it gets tricky. You can't publish in this album unless you have a token for the page from an administrator of that page with the manage_pages
permission. I don't think you can do this with the JavaScript SDK, but even if you could, it would be risky exposing that token to the end user.
I would create a server script with PHP or your favorite language, probably hard code the token and album id for that page, and upload the image with JavaScript to the back-end script, which then uploads it to the Facebook album. This should take no more than a few lines of code. Look in the documentation for an example about uploading images to a specific album. Good luck.
精彩评论