Tuesday, 8 April 2014

Facebook User Profile Get Custom Picture of Facebook User

Facebook User Profile Get Custom Picture of Facebook User


Today, Every one use the Facebook for social networking whether he is Student, Working Women, House wives, IT Professional or Business man etc. Everyone open Facebook account at-least once a day.

Due to huge use of Facebook profiles.  All Web application start integrate the Facebook plugins in their websites.
They Start using plugins like Registration, Like plugin, Comment box, Login/Logout functionalists and Chat implement.

Many times, we need to show the Profile pictures of Facebook users in web page. Sometimes you have to show the custom size of profile picture. If there is requirement of showing the custom images of profile user then you are very right place. Here we are giving you lot of example of custom size.

You can show the profile pictures in unlimited sizes. Just fill the height width parameter in URL and your profile picutre is ready. to show the Profile picture you need 1 parameter only and that is UID. UID is user id and facebook users and its unique.



If we have facebook profile Id, then we can get different facebook profile images with the following URLs.
http://graph.facebook.com/[UID]/picture?type=square
https://graph.facebook.com/[UID]/picture?width=[WIDTH]&height=[HEIGHT]
Here [UID] is Facebook Profile Id and [WIDTH]/[HEIGHT] is width/height



Very Small Profile Image(50 X 50)
Very Small Profile Image(50 X 50)
https://graph.facebook.com/1438566719/picture?width=50&height=50
Profile Thumbnail Profile Thumbnail
http://graph.facebook.com/1438566719/picture?type=square
Large Profile Image (300 X 300)
Large Profile Image (300 X 300)
https://graph.facebook.com/1438566719/picture?width=300&height=300



5 Best Related Posts are Following:1. Facebook comments box for website
2. Facebook login with javascript SDK example
3. Facebook User Profile Get Custom Picture of Facebook User
4. Facebook Login with JavaScript
5. Firebase Chat with Facebook and Twitter Integration

Thursday, 3 April 2014

Facebook Login with JavaScript

Follow Simple Steps to Integrate "Facebook Login" with JavasScript in your Web Application.

  • Login in https://www.facebook.com/
  • "Create a New App" in https://developers.facebook.com/
  • Fill all required Information
  • Settings => App PlateForm=>Click on "Website" then add detail
  • In "Status & Review", Click on "Yes" to activate for public


Get the "App Id" and use in Following Example
<html>
    <head>
        <title>Facebook Login Integration with JavaScript</title>
        <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    </head>
    <body>

        <div id="fb-root">
</div>
<script>
            window.fbAsyncInit = function() {
                FB.init({
                    appId      : 'XXXXXXXX',//your appid
                    status     : true, 
                    cookie     : true,
                    xfbml      : true,
                    oauth      : true                    
                });
                FB.Event.subscribe('auth.authResponseChange', function(response) {                    
                    // Here we specify what we do with the response anytime this event occurs. 
                    if (response.status === 'connected') {
                        saveuserdetail();
                    } else if (response.status === 'not_authorized') {
                        // In this case, the person is logged into Facebook, but not into the app, so we call                        
                        FB.login();
                    } else {
                        // In this case, the person is not logged into Facebook, so we call the login()                         
                        FB.login();
                    }
                })  
  
            };
        
            function saveuserdetail() {
                //console.log('Welcome!  Fetching your information.... ');
                FB.api('/me', function(response) {                    
                    console.log(response.toSource());
                    $.ajax({                        
                        type: "POST",
                        url: '/url_to_save_detail',
                        data: response,
                        success: function(msg){
                        console.log(msg);    
                        },
                        dataType: 'json'
                    });
                });
            }
            (function(d){
                var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
                js = d.createElement('script'); js.id = id; js.async = true;
                js.src = "//connect.facebook.net/en_US/all.js";
                d.getElementsByTagName('head')[0].appendChild(js);
            }(document));
        </script>
        <div class="fb-login-button">
Login with Facebook</div>
</body>
</html>



Facebook Login URL:
https://www.facebook.com/dialog/oauth?redirect_uri=websiteLoginURL&display=popup&response_type=code&client_id=appId&ret=login
websiteLoginURL: After login which page of your website should redirect.
appId: Application Id of facebook.com