O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Worth a Thousand Words: Profile Pictures

Problem

Profile pictures are awesome because they’re so easy to recognize and they really draw people in! How can I display someone’s pic?

Solution

The fb:profile-pic tag will display the Profile picture for the user specified by the uid parameter. The simplest form is:

<fb:profile-pic uid="12345"/>

Discussion

In addition to the uid, there are two optional parameters, listed in Table 6-3.

Table 6-3. Parameters for fb:profile-pic

Name

Type

Default value

Description

uid

int

N/A

The Facebook user ID (uid) of the user or Page whose pronoun you want to show. You can also use loggedinuser or profileowner. This is the only required field.

linked

bool

true

Link to the user’s Profile.

size

string

thumb

Size of image to display (see the upcoming list).

Differently sized pics can be hugely useful in different scenarios. Using my current Profile picture (taken by my good friend Will Pate), the following list shows a breakdown of the options (note that you can use the short form listed in parentheses):

thumb (t): 50 pixels wide
image with no caption
small (s): 100 pixels wide
image with no caption
normal (n): 200 pixels wide
image with no caption
square (q): 50×50 pixels

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required