I use the facebook-php-sdk to create an event for a page.
Now as described here it is possible to upload a picture to an event.
The problem with that is, tha
yes. You can upload cover photo using Graph API. Once you have created the event, you can use cover_url field to upload the cover photo. 'cover_url' => url of the photo.
I just figured out how to do it using the Facebook PHP SDK:
1- POST the Facebook event on the page using
$attachment = array(
'access_token' => $access_token,
'name' => $title,
'start_time' => $start_time,
'description' => $description
);
$res = $fb->api('/PAGE_ID/events/', 'post', $attachment);
2- Retrieve the EVENT_ID from the result of the post
$fb_event_id = $res['id'];
3- Update the event by calling /EVENT_ID with the cover parameter
$attachment['cover'] = '@/path/to/image.jpg';
$fb->api('/'.$fb_event_id, 'post', $attachment);
That's it !!
All answers above are wrong! There is only one way to create the Cover Image:
Create The Event:
$eventData = array(
'name' => 'Event Title',
'start_time' => 'StarttimeInCorrectFormat',
'description' => 'Event Description'
);
$fbEvent = $fb->api('/PAGE_ID/events/', 'post', $eventData);
Update the Event using the ID from above:
$cover['cover_url'] = 'http://urlToCoverImage.jpg';
$eventUpdate = $facebook->api( "/" . $fbEvent['id'], 'post', $cover );
return true or false.
And thats it. Cover is in.