Upload image to Facebook Wall / Feed via Graph API -
i trying upload local images directly pages feed (i.e. "wall photos" album).
this code think should work:
<?php $facebook = new facebook(array( 'appid' => $the_app_id, 'secret' => $this_app_secret, )); $facebook->setaccesstoken($the_access_token); $facebook->setfileuploadsupport(true); $attachment = array( 'message' => $the_post_body, 'name' => $this_image_name, 'picture' => '@' . $the_absolute_path_to_image ); $result = $facebook->api('/me/feed, 'post', $attachment); but code yields plain text wall post contents of "message" (i.e. picture field seemingly ignored). have tried "/page_id/feed", same result.
now, changing endpoint "/me/photos", upload photo 'normal' album name of app, want normal post possible , hence "wall photos" album).
i realise achieve querying graph fql find object_id of "wall photos" album, if not exist require permissions create , rather keep permissions simple possible.
if point out how upload photos "/me/feed" appreciate it.
but code yields plain text wall post contents of "message" (i.e. picture field seemingly ignored). have tried "/page_id/feed", same result.
you can give link picture not data.
now, changing endpoint "/me/photos", upload photo 'normal' album name of app, want normal post possible , hence "wall photos" album).
ye, creates album default based on app. if exists, uploads album. , generates post.
i realise achieve querying graph fql find object_id of "wall photos" album, if not exist require permissions create , rather keep permissions simple possible.
you cannot upload fb me/feed end point. should store in server/s3/some service , give public url me/feed params.
Comments
Post a Comment