0
我有一個在Facebook上的測驗應用程序。它會在測驗結束時將照片上傳到用戶的照片。Facebook API照片上傳imagepng
$photo_upload = $facebook->api('/me/photos', 'POST', array(
'source' => '@' . './images/userimg.png',
'message' => $message,
)
);
但它是一個示例圖像,每個人都一樣。我想通過在圖像上寫下用戶的名字來使其變得個人化。的部分創建-img.php:
try {
$user_profile = $facebook->api('/me');
}
catch (FacebookApiException $e) {
error_log($e);
$user_id = null; }
$username = iconv("UTF-8", "ISO-8859-2", $user_profile['name']);
$text = iconv("ISO-8859-2", "UTF-8", "Hello ". $username);
...
header('Content-type: image/png') ;
ImagePNG($image) ;
ImageDestroy($image) ;
imagepng($image, "./images/imgs_to_post/sample_userimg.png");
exit ;
它可以包含在HTML,做工精緻,圖像顯示了用戶的姓名。
<img src="create-img.php" alt="" />
但是當我嘗試將create-img.php作爲上述API調用的源代碼時,出現錯誤。
Fatal error: Uncaught OAuthException: (#1) An unknown error occurred thrown in /home/mmdesign/public_html/.../php-sdk/base_facebook.php on line 1128
我怎樣才能把imagepng的結果圖像API調用源?
預先感謝您。