Facebook PHP SDK:上传事件封面照片 [英] Facebook PHP SDK: Upload Event Cover Photo
问题描述
我使用Facebook-php-sdk为页面创建一个事件。
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.
问题是,这是个人资料图片。但是自从一年多以来,Facebook为活动提供了新的大型封面照片。我想将图片上传到那里,而不是作为个人资料图片。那可能吗?我没有在 Facebook开发人员图Api活动页面上找到任何帮助因为只有上传个人资料图片的方式(HTTP POST TO / EVENT_ID / picture)。
The problem with that is, that this is the profile picture. But since more than a year now, facebook provides new, large cover photos for events. I want to upload a picture to there, not as a profile picture. Is that possible? I didn't find any help on the Facebook Developer Graph Api Events Page as there only the way to upload a profile picture is described (HTTP POST TO /EVENT_ID/picture).
简而言之:是否可以上传封面照片事件通过Graph API?
In short: Is it possible to upload a cover photo for an event via the Graph API?
更新:我试图将图片上传到页面相册并检索图片ID。然后,我尝试选择这张照片作为事件的封面照片。
UPDATE: I tried to upload a picture to the pages photo album and retrieve the picture id. I then tried to select this picture as the cover photo of the event.
$cover = array(
'cover' => $uploaded_photo_id,
);
$fb->api('/' . $this->FacebookEventID, 'POST', $cover);
令人遗憾的是,这不是直接在页面上。
Sadly, this isn't working as it is directly on pages.
我开始认为,现在是不可能的。
I'm starting to think, that this isn't possible as of now.
另外,如果你通过网站设置封面照片您可以使用 https://graph.facebook.com/Event_ID?fields=cover
查询图表api,这将返回封面。
Also if you set a cover photo via the website, you can query the graph api with https://graph.facebook.com/Event_ID?fields=cover
which will return the cover.
更新:
我还没有成功。但是,如果您回答,请记住:我想将封面图片上传到活动!不是个人资料
I still had no success. But if you answer, please keep in mind: I want to upload a cover picture to the event! NOT A PROFILE PICTURE
推荐答案
以上所有答案都是错误的!创建封面图片只有一种方法:
All answers above are wrong! There is only one way to create the Cover Image:
创建事件:
$eventData = array(
'name' => 'Event Title',
'start_time' => 'StarttimeInCorrectFormat',
'description' => 'Event Description'
);
$fbEvent = $fb->api('/PAGE_ID/events/', 'post', $eventData);
使用上面的ID更新活动:
Update the Event using the ID from above:
$cover['cover_url'] = 'http://urlToCoverImage.jpg';
$eventUpdate = $facebook->api( "/" . $fbEvent['id'], 'post', $cover );
返回true或false。
return true or false.
而已。封面在。
这篇关于Facebook PHP SDK:上传事件封面照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!