私がしたいことは、Facebookにアルバムを作成してアルバムに写真をアップロードすることです。これでアルバムはFacebookに作成されますが、写真をアルバムにアップロードすることはできません。なぜアルバムIDを取得できないのか、任意の解決策またはアイデア?なぜFacebookのアルバムIDを取得できないのですか?
$pathToFile = "/some/path/someimage.jpg";
$facebook->setFileUploadSupport(true);
............
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//get the album id
$album_uid = $create_album["id"]; // no need for foreach loop
.....
$args = array('message' => 'Some message');
$args['image'] = '@' . realpath($pathToFile); //see realpath use here
$data = $facebook->api('/'. $album_uid . '/photos', 'post', $args);
はそれを願っています:ここ
は、アルバムを作成して、Facebookを利用して
<?//At the time of writing it is necessary to enable upload support in the Facebook SDK, you do this with the line:
$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message'=> 'name',
'name'=> 'name'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//Get album ID of the album you've just created
$albums = $facebook->api('/me/albums');
foreach ($albums["data"] as $album) {
//Test if the current album name is the one that has just been created
if($album["name"] == 'name'){
$album_uid = $album["id"];
}
}
//Upload a photo to album of ID...
$photo_details = array(
'message'=> 'test'
);
$file='http://scm-l3.technorati.com/11/12/30/59287/google-logo-682-571408a.jpg'; //Example image file
$photo_details['image'] = '@' . realpath($file);
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
//print_r($upload_photo);
?>
おかげ
あなたの問題は、アルバムにalbum_uidや画像のアップロードですか..? –
私はalbum_idを取得しました。問題は今アルバム – Oscar