Skip to main content

To get full size profile picture from facebook

The default profile picture from Facebook API:

Use this link:
http://graph.facebook.com/<user.id>/picture?type=large
(note:without using type variable you will receive a 50x50 image of user)

The Full Size profile picture:

Assumptions

The following scripts assume a couple of things:

Graph API method

The following Graph API method works by doing two API calls: The first requests all the user albums and gets the ID of the album with the name “Profile pictures”, the second gets the first image from that album. Conveniently, the current profile picture is always the first in the returned list.
//Get a list of all the albums FB.api('/me/albums', function (response){ for (album in response.data) { // Find the Profile Picture album if(response.data[album].name == "Profile Pictures"){ // Get a list of all photos in that album. FB.api(response.data[album].id + "/photos", function(response){ //The image link image = response.data[0].images[0].source; }); } } });

FQL method

The FQL method also requires two api calls: one to get the user id, and a second FQL query for that user’s profile picture. You could lower this to one API call if you store the user id sometime earlier.
//get the current user id FB.api('/me', function (response){ /* the FQL query: Get the link of the image, that is the first in the album "Profile pictures" of this user.*/ var query = FB.Data.query('select src_big from photo where pid in (select cover_pid from album where owner={0} and name="Profile Pictures")', response.id); query.wait(function (rows){ //the image link image = rows[0].src_big; }); });

Comments

Popular posts from this blog

access logs to PDT

zgrep "text" /var/log/nginx/access.log | awk '{print $6}' | sed -e 's/\"/\ /g' | awk -F'[:/]' '{   # Build a new date string that GNU date can understand   timestamp = $1 " " $2 " " $3 " " $4 ":" $5 ":" $6   cmd = "TZ=\"America/Los_Angeles\" date -d \"" timestamp " UTC\" \"+%Y-%m-%d %H:%M:%S %Z\""   cmd | getline converted   close(cmd)   print converted }'

Installing Nginx for PHP, MySQL

Nginx is a high performance HTTP server. It provides very fast speed of delivering web pages, and uses fewer resources at the same time. With Nginx (Pronounced Engine X) A server with low resources will be able to serve many more clients, due to this, many popular websites use this (To conserve their resources, of course). In this blog post, I am going to discuss how to install Nginx, along with PHP, and MYSQL. You will need to follow very close attention to this article, else, one mistake and you may need to restart all over again. The first thing you will need to do of course is own a VPS/Dedicated server. You will also need to have an SSH Client (Putty), and your username and password. If you have all of this, the first thing you need to do is login to your panel, and rebuild the server with some version of CentOS (it does not matter what version, really). Once you have done so, login to your SSH client, supplying the required information. Next, we are going to begin the actu...

Using a SOAP service as DLL

By default, when you do an Add Service Reference operation, the WCF runtime will generate the client-side proxy for you. The simplest way to use it is to instantiate the client proxy with a constructor that takes no parameters, and just grab the info from the app.config : YourServiceClient proxy = new YourServiceClient(); This requires the config file to have a <client> entry with your service contract - if not, you'll get the error you have. But the client side proxy class generated by the WCF runtime also has additional constructors - one takes an endpoint address and a binding, for instance: BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.Transport;  EndpointAddress epa = new EndpointAddress("http://example.com/api/?wsdl"); YourServiceClient proxy = new YourServiceClient(binding, epa); With this setup, no config file at all is needed - you're defining everything in code. Of course, you can also s...