0

任何人都可以阐明我的问题吗?

<?php

$config = array();
$config['appId'] =  "foo";
$config['secret'] = "bar";
$config['cookie'] = true;
$config['fileUpload'] = true;

$facebook = new Facebook($config);

$eventParams = array(
    "privacy_type"  => $this->request->data['Event']['privacy'],
    "name"          => $this->request->data['Event']['event'],
    "description"   => $this->request->data['Event']['details'],
    "start_time"    => $this->request->data['Event']['when'],
    "country"       => "NZ"
);

//around 300x300 pixels
//I have set the permissions to Everyone
$imgpath = "C:\\Yes\\Windows\\Path\\Photo_for_the_event_app.jpg"; 
$eventParams["@file.jpg"] = "@".$imgpath;

$fbEvent = $facebook->api("me/events", "POST", $eventParams);

var_dump($fbEvent); //I get the event id

当要求用户允许应用代表他发布时,我的“范围”中也有这个:user_about_me,email,publish_stream,create_event,photo_upload

这行得通。它使用我指定的所有详细信息创建事件。除了活动图片。

我去过大多数与我的问题相关的 Stackoverflow 帖子,但它们都不适合我。(例如:https ://stackoverflow.com/a/4245260/66767 )

我也没有收到任何错误。

有任何想法吗?

谢谢!

4

1 回答 1

0

是的,这个想法是 Facebook 有错误。我也有事件图片的问题。跟踪器中的主题,这是我 在 stackOverflow 上的帖子

顺便说一句,您可以在创建事件后尝试此代码 ->

public function uploadFacebookEventPicture($fullPath, $eventId) {
    $mainImage = '@' . $fullPath;   
    $imgData = array(
        'picture' => $mainImage
    );
    try {
        $data = $this->facebook->api('/'.$eventId, 'post', $imgData);
        return $data;
    } catch (FacebookApiException $e) {
        error_log('Failed to attach picture to event. Exception: ' . $e->getMessage());
    }       
    return null;
} 

也许它对你有用,对我来说,自从发现 Facebook 问题后它就停止工作了。

于 2012-08-29T14:57:25.290 回答