如何通过API上传时间轴页面选项卡的自定义应用程序图像(tab_image)? [英] How to upload custom app image (tab_image) for Timeline Page tabs via API?
问题描述
Facebook今天发布了新的时间表页。现在,安装到页面的应用程序Apps现在显示在时间轴的上方,尺寸为111px x 74px的缩略图app image。如果您浏览Facebook页面管理界面,您可以在每页级别(如同自定义选项卡名称)自定义。
Facebook released the new Timeline for Pages today. Apps installed to pages as "tabs" now appear above the timeline with a 111px x 74px size thumbnail "app image". You can customize this on a per-page level (just like the custom tab name) if you navigate the Facebook Page admin interface.
您可以更新该选项卡的自定义名称通过 Open Graph API ,但它们似乎没有更新了他们的API文档,以显示如何上传自定义tab_image(假设他们会)。现在有可能没有文件吗?有没有人知道如何做到这一点?
You can update the tab's "custom name" via the Open Graph API, but they do not appear to have updated their API docs to show how to upload a custom tab_image (assuming they will). Is it possible now but undocumented? Has anyone figured out how to do this yet?
推荐答案
2016年更新:
使用最新的Open Graph 2.5 API 标签
端点和 PHP SDK 5 ,代码应该如下所示:
Updated 2016:
With the latest Open Graph 2.5 API tabs
endpoint and PHP SDK 5, the code should look like this:
<?php
$fb = new Facebook\Facebook([/* . . . */]);
$response = $fb->post(
'/{page-id}/tabs',
[
'custom_name'=>'My Custom Tab',
'custom_image_url'=>'http://publicly.accessible/image.jpg',
'app_id'=>'{app-id}',
],
'{page-access-token}',
);
原始2012帖子:
它出来,就像上传图像一样。该字段称为custom_image。大概他们会尽快更新文档。很高兴他们使用新版本快速启用了这个API钩子!
Original 2012 post:
I figured it out, it's just like uploading an image. The field is called "custom_image". Presumably they will update the documentation soon. It's nice they enabled this API hook so quickly with the new release!
以下是 Facebook PHP SDK :
<?php
$page_access_token = 'XXXXXXX'; // you'll need the manage_pages permission to get this
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
'fileUpload' => true, // enables CURL @ file uploads
));
$facebook->api(
'/PAGE_ID/tabs/TAB_NAME', // looks like "app_xxxx" where xxxx = APP_ID
'POST' // post to update
array(
'custom_image' => '@' . realpath('path/to/my/file.jpg'),
'custom_name' => 'My App', // give it a custom name if you want too
'access_token' => $page_access_token // access token for the page
)
);
干杯
这篇关于如何通过API上传时间轴页面选项卡的自定义应用程序图像(tab_image)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!