【问题标题】:Create a facebook Event with PICTURE (Javascript)使用 PICTURE (Javascript) 创建一个 facebook 事件
【发布时间】:2011-10-23 22:03:18
【问题描述】:

我开始使用 facebook graph api 通过 javascript 创建事件! 它工作得很好,除了图像。 我以这种方式创建事件:

FB.api("/"+idOwner+"/events?access_token="+access_token,'post',{ 
    name: 'TEST',
    start_time: '2011-12-01T15:00:00',
    privacy_type:"OPEN",
    end_time: '2011-12-02T15:00:00',
        location: 'here',
    picture: 'http://www.ostianews.it/wp-content/uploads/2010/06/rock.jpg'              
});

idOwner 和 access_token 是两个变量。 通过这种方式,它创建了我没有图片的事件。 如何在我的活动中加载图片???? 晚上好!!!再见!

【问题讨论】:

    标签: javascript events facebook-graph-api image


    【解决方案1】:

    您可以考虑使用以下解决方案

    $photo = './images/logo-square.png';// Must be an image on your server
    $event_info = array(
    "privacy_type" => "OPEN",
    "name" => "Event Title",
    "page_id" => YOUR_PAGE_ID,
    "start_time" => "2012-01-22 09:00:00",
    "end_time" => "2012-02-22 09:00:00",
    "description" => "Event Description"
    );
    
    //The key part - The path to the file with the CURL syntax
    $event_info[basename($photo)] = '@' . realpath($photo);
    //Make the call and get back the event ID
    $result = $this->facebook->api($this->id.'/events','post',$event_info);
    

    如果你绝对想在 JS 中做,制作一个 ajax 来执行这段代码并返回 Event Id ($result["id"])

    我做到了,而且效果很好。

    ps:感谢 Adam Heath 在Attach image to Facebook event (php sdk, rest or graph api)找到解决方案

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多