I am trying to upload local images directly to a pages feed (i.e. "Wall Photos" album).
This is the code that I 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 this code just yields a plain text wall post with the contents of "message" (i.e. picture field is seemingly ignored). I have also tried "/page_id/feed", same result.
Now, simply changing the endpoint to "/me/photos", does upload the photo to a 'normal' album with the name of the app, but I want it to look as much like a normal post as possible and so hence into the "Wall Photos" album).
I realise that I could achieve this by querying the graph with FQL to find the object_id of the "Wall Photos" album, but if it does not exist it would require extra permissions to create it and I would rather keep permissions as simple as possible.
If anyone could point out how to upload photos to "/me/feed" I would greatly appreciate it.