imagejpeg()[function.imagejpeg]:无法打开'img / 100001326588945.jpg'进行写作

时间:2012-05-01 14:02:07

标签: php facebook facebook-graph-api web-applications photo-upload

$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)个错误

  1. 警告:imagejpeg()[function.imagejpeg]:无法打开'img / 100001326588945.jpg'进行写入:第58行/home/a2424901/public_html/index.php中没有此类文件或目录< / p>

  2. curl_setopt_array()[function.curl-setopt-array]:open_basedir限制生效。 File()不在允许的路径中:(/ home /:/ usr / lib / php:/ tmp)位于第802行的/home/a2424901/public_html/base_facebook.php

  3. 致命错误:未捕获的CurlException:3:没有设置网址!在第814行的/home/a2424901/public_html/base_facebook.php中引用。

  4. Here is the base_facebook.php code

    谢谢!

1 个答案:

答案 0 :(得分:0)

尝试放置相对路径而不是放置绝对路径,至少我是如何解决该问题的。