How to publish to stream multiple images with Facebook Graph api?
I'd like to attach not just one picture, but multiple, as in 2 or more to the wall. How can I achieve thi开发者_如何学编程s with the Graph API? I recall some other app companies were doing this and I want to know how they achieved this.
One solution would be to allow users to upload photos to your own server and then allow the user to submit the photos to facebook.
$file = 'path_to_image'; // Dont forget to add $_SERVER['DOCUMENT_ROOT'] $photo_details['image'] = '@' . realpath($file);
$upload_photo = $facebook-api('/me/photos','post',$photo_details);
The photos will be uploaded to your application's album. Alternatively you can substitute "/me/photos" for "/$album_id/photos", if you wish to upload your photos to a specific album.
When you upload several photos ( even if there is some delay between uploads ) the story in the news feed will contain previews of three of the recently uploaded photos.
精彩评论