如何使用PHP SDK将视频和缩略图一起上传到Facebook?
答
$fb = new Facebook\Facebook([
'app_id' => FB_APP_ID,
'app_secret' => FB_APP_SECRET,
'default_graph_version' => 'v2.8',
]);
//add parameter to scheduled_publish_time
$data = [
'title' => $vid_name,
'message' => $vid_desc,
'source' => $fb->fileToUpload(VIDEO_PATH.$vid_id."/".$video['vid_filename']),
];
//$thumbfile is thumbnail path.
if(!empty($thumbfile)){`enter code here`
$data['thumb'] = imagecreatefromstring(file_get_contents($thumbfile));
}
$response = $fb->post('/me/videos', $data, $token);