Fb:profile-pic

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

Turns into an img tag for the specified user's or Facebook Page's profile picture.

The tag itself is treated like a standard img tag, so attributes valid for img are valid with fb:profile-pic as well. So you could specify width and height settings instead of using the size attribute, for example.

Attributes

RequiredNameTypeDescription
required uid int The user ID of the profile or Facebook Page for the picture you want to display. On a canvas page, you can also use "loggedinuser".
optional size string The size of the image to display. (Default value is thumb.). Other valid values are thumb (t) (50px wide), small (s) (100px wide), normal (n) (200px wide), and square (q) (50px by 50px). Or, you can specify width and height settings instead, as described below.
linked bool Make the image a link to the user's profile. (Default value is true.)
facebook-logo bool (For use with Facebook Connect only.) When set to true, it returns the Facebook favicon image, which gets overlaid on top of the user's profile picture on a site.
width int Specifies the desired width, in pixels, of the image (like an img tag).
height int Specifies the desired height, in pixels, of the image (like an img tag).

Examples

If you're formatting the tag as FBML, you don't need to use a closing tag.

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


If you're formatting the tag as XFBML for Facebook Connect or an iframe application, you must use a closing tag.

<fb:profile-pic uid="12345" facebook-logo="true" linked="false" width="300" height="400"></fb:profile-pic>

Note: If you're specifying a custom image size (using the height and width attributes), you no longer need to include px for each dimension.


Another FBML example.

<fb:profile-pic uid="12345" width="32" height="32" linked="true" />


It seems that a size of "normal" currently provides the best quality available through this tag. If you need an image larger than 200px wide and need this done within FBML, you can use size "normal" in combination with width. This example creates an image twice the width of size "normal" in the best quality possible with this tag.

<fb:profile-pic uid="12345" size="normal" width="400" />

Notes

If you need a larger version of the photo, don't want to stretch out the 200px wide photo, and can deal with having to use an API call rather than being able to use an FBML tag, the URL for the gallery-view image (up to 604px in width or height) can be obtained using FQL via the src_big column of the photo table (example included)

If you use this tag on a mobile canvas page, links created still point to the Facebook Full Site (www.facebook.com) rather than the mobile site.

reference