【问题标题】:upload image to facebook group上传图片到脸书群组
【发布时间】:2012-07-04 05:06:04
【问题描述】:

谁能指出一些处理通过群组帖子将图像上传到群组的代码?

我在这里找到了一些代码:

//IF FILE UPLOAD
if ((($_FILES["file"]["type"] == "image/gif")
   || ($_FILES["file"]["type"] == "image/jpeg")
   || ($_FILES["file"]["type"] == "image/png")
   || ($_FILES["file"]["type"] == "image/pjpeg"))
     && ($_FILES["file"]["size"] < 2000000))
   {
    if ($_FILES["file"]["error"] > 0){
       $error .= "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }else{
       echo "Upload: " . $_FILES["file"]["name"] . "<br />";
       echo "Type: " . $_FILES["file"]["type"] . "<br />";
       echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
       echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";    
       //facebook part below
       $args = array('message' => $_GET['title']);
       $args['image'] = '@' . realpath($_FILES["file"]["tmp_name"]);
       $data = $facebook->api('/GROUP_ID/photos', 'post', $args);
       $entry->details = $data['id'];
    }
}

由于它显示 /photos,我认为它只会将上传到照片选项卡中的图像放置在组内。但是,我只想将它张贴在小组本身的墙上(如果需要,可以使用我作为海报,因此不需要登录)。

但是,由于我无法找到组的示例,我想知道还需要哪些其他代码才能使其与 FB API 一起正常工作?我需要什么代码才能使用 $_FILES["file"] 命令(this 可能?)。

【问题讨论】:

    标签: php facebook facebook-graph-api image-uploading image-upload


    【解决方案1】:

    我认为应该是:

    $data = $facebook->api('/GROUP_ID/feed', 'post', $args);
    

    也试试看here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-25
      • 2013-07-10
      相关资源
      最近更新 更多