开发者

how to save the image of facebook user form my facebook api to my database?

I have registration page where i fetch user details suchas firs开发者_JS百科tname and lastname and its image my question is how i can store the image of a user into my database?


well I can give you example in which you don't store the image itself but the profile image's link to your database.

        $fb_access_token=$session['access_token'];
        $fbme = $facebook->api('/me');
        $photolink = 'http://graph.facebook.com/'.$fbme['id'].'/picture?type=square';
$fbid = $fbme['id'];

//connect to db $query = "INSERT INTO users (fbid,photo_link) VALUES ('".$fbid."', '".$photolink."')"; mysql_query($query) or die(mysql_error());

You can specify the picture size you want with the type argument, which should be one of square (50x50), small (50 pixels wide, variable height), normal (100 pixels wide, variable height), and large (about 200 pixels wide, variable height)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜