dongsuiying7773 2013-09-26 15:21
浏览 49

使用PHP将图像发布到Facebook时,仅显示缩略图

When publishing picture to my FB page as an Admin using PHP, it appears as a thumbnail. I would like to appear it as full size picture

Code I'm using:

$page_info = $facebook->api("/$page_id?fields=access_token");
$page_access_token = $page_info['access_token'];

$data['picture'] = "image.jpg";
$data['link'] = "link";
$data['message'] = "message";
$data['access_token'] = $page_access_token;

$post_url = 'https://graph.facebook.com/'.$page_id.'/feed';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($ch);
curl_close($ch);

Any help?

Here is How I would like it to be displayed - http://i.stack.imgur.com/0PUOS.png

Thank you


Thank you for the answers,

I tried remove the link but it didn't work. I searched more and tried the following code, but it gives me error >>>

Warning: curl_setopt_array() [function.curl-setopt-array]: open_basedir restriction in effect. File() is not within the allowed path(s): (/data/web/virtuals/17535/virtual) in /data/web/virtuals/17535/virtual/www/apps/fb/src/base_facebook.php on line 963 Fatal error: Uncaught CurlException: 3: No URL set! thrown in /data/web/virtuals/17535/virtual/www/apps/fb/src/base_facebook.php on line 994

require 'facebook.php';
$facebook = new Facebook(array(
'appId'  => '111111111111',
'secret' => '222222222222222222',
   'fileUpload' => true
));

$page_id = '3333333333333';
$page_info = $facebook->api("/$page_id?fields=access_token");
$page_access_token = $page_info['access_token'];     

$image = "http://www.emperola.com/upload-01/18001-img_hero.jpg";

$args = array(
        'access_token'  => $page_access_token,
        'message'       => 'message',
        'name'          => 'Title',
        'picture'       => $image
    );

    $post_id = $facebook->api("/$page_id/feed","post",$args);

Thank you for your help

  • 写回答

2条回答 默认 最新

  • dqg2269 2013-09-26 15:27
    关注

    Currently, you're telling Facebook your post is a link. You need to modify it so it isn't a link, and more like a "status update". Try removing the "link" property from your API call to Facebook and adding the URL to the message. If that doesn't work, as @CRroe said in a comment, you'll need to upload the image to Facebook using the API, then share that photo on the page/user timeline.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端