Facebook PHP SDK: upload photos

I am using facebook-php-sdk to create an event for the page.

Now, as described here , you can upload an image to the event.

The problem is that this is a profile picture. But since more than a year ago, facebook has been offering new, big covers for events. I want to upload an image there, not a profile image. Is it possible? I did not find any help on the Facebook Developer Graph Api Events page, as the method for loading the profile image (HTTP POST TO / EVENT_ID / picture) is described.

In short: is it possible to upload a cover photo for an event through the Graph API?

UPDATE: I tried to upload the photo to the photo album and get the image ID. Then I tried to select this image as the cover of the event.

$cover = array( 'cover' => $uploaded_photo_id, ); $fb->api('/' . $this->FacebookEventID, 'POST', $cover); 

Unfortunately, this does not work as it does on the pages.

I'm starting to think that this is not possible at the moment.

Also, if you install the cover using the website, you can request an api schedule using https://graph.facebook.com/Event_ID?fields=cover which will return the cover.

UPDATE:

I still had no success. But if you answer, please keep in mind: I want to download the cover for the event! NOT PROFILE PICTURE

+4
source share
3 answers

All answers above are incorrect! There is only one way to create Cover Cover:

Create 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 above:

 $cover['cover_url'] = 'http://urlToCoverImage.jpg'; $eventUpdate = $facebook->api( "/" . $fbEvent['id'], 'post', $cover ); 

return true or false.

And here it is. The lid is located.

+6
source

Yes. You can load the cover using the Graph API. After creating the event, you can use the cover_url field to load the cover. 'cover_url' => URL of the photo.

0
source

I just figured out how to do this using the PHP PHP SDK:

1- POST 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- Get EVENT_ID from message result

 $fb_event_id = $res['id']; 

3- Update the event by calling / EVENT _ID with a cover parameter

 $attachment['cover'] = '@/path/to/image.jpg'; $fb->api('/'.$fb_event_id, 'post', $attachment); 

What is it!

0
source

All Articles