I'm creating a facebook event through the php sdk using
$param = array(
'name' => $name,
'start_time' => $ate,
'description' => $description,
'picture' => $photo
);
$facebook->api('/me/events', 'POST', $param);
Is it possible to set a cover photo for the event that is being created at this call? If not, can I set it somehow?
The documentation says that the cover field needs a photo id. If I haven't uploaded the photo yet, it doesn't have an id, so what do I do?
Do I upload the photo to the facebok account of user that issuing the "create event" action, getting that way the photo id, and then post it to the event?
What if I don't want to upload it to the users profile?
Thank you
To upload a cover photo of an event- Firstly, you cant do this while creating the event. You first have to create an event, as a result you'll get the
event_id
. Use thisevent_id
, to make a call:\POST /{event-id}
with param:cover_url
That's the only way to do it as of now (I've tested). The method describe in this documentation dont work as of now, this is reported as a bug. You can subscribe to this bug to get any updates regarding the same.
Code:
Code example, upload cover photo when create event:
Code example, After event created, you can also replace cover photo by upload new photo: