簡體   English   中英

如何使用JS和API在用戶的Facebook個人資料個人資料上標記和上傳圖像

[英]How to tag and upload image on user's facebook profile profile using JS and API

如何標記圖像並將其上傳到應用程序的用戶個人資料?

我正在使用以下對我不起作用的代碼。
在結果頁面上之后,用戶在應用程序的登錄頁面上將上傳,發布和offline_access范圍授予了我的應用程序。

我正在使用此代碼:

function graphStreamPublish(session){
            showLoader(true);

            FB.api('/me/feed', 'post',
                {
                    message     : "trying to publish image",

                    picture     : 'http://localhost:8085/myweb/images/arranged2.jpg',
                    name        : 'This is my demo Facebook application (JS SDK)!',
                    description : 'It is fun to write Facebook App!!'

            },function(response) {
                showLoader(false);

                if (!response || response.error) {
                    alert('Error occured');
                } else {
                    alert('Post ID: ' + response.id);
                }
            });
        }

我是否還需要在頁面上執行Fb.init?
我在<body>標記后放置了上面的代碼,對嗎?
如何在同一張圖片上標記用戶?

這將不起作用,facebook-server將嘗試下載picture-url,因為此URL為localhost ,這將失敗,因為localhost在此上下文中表示Facebook-Server,而不是您的服務器。 將圖片URL替換為公共可用URL。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM