$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message'=> 'How will you die?',
'name'=> 'How will you die?'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//Get album ID of the album you've just created
$album_uid = $create_album['id'];
//Upload a photo to album of ID...
$file='img/'.$fbid.'.jpg'; //Example image file
$photo_details = array( 'message'=> 'Find...51', 'image' => '@'.realpath($file));
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
$upphoto = $upload_photo['id'];
print_r ($upphoto);
ImageDestroy( $canvas );
header("Location: http://www.facebook.com/" . urlencode($fbid) . "&photoid=" . urlencode($upload_photo['id']));
我正在使用此代码在 facebook 应用程序的帮助下创建相册并在 facebook 上的用户个人资料中上传照片。但是一次又一次,我反复遇到三 (3) 个错误
警告:imagejpeg() [function.imagejpeg]:无法打开“img/100001326588945.jpg”进行写入:第 58 行的 /home/a2424901/public_html/index.php 中没有此类文件或目录
curl_setopt_array() [function.curl-setopt-array]:open_basedir 限制生效。File() 不在允许的路径内: (/home/:/usr/lib/php:/tmp) 在 /home/a2424901/public_html/base_facebook.php 的第 802 行
致命错误:未捕获的 CurlException:3:未设置 URL!在第 814 行的 /home/a2424901/public_html/base_facebook.php 中抛出。
谢谢 !