On custom Facebook pages images must exist on your own server (or somewhere else on the internet) and linked to from the Facebook page code.
The only images that can be uploaded directly to Facebook are the logo for your fan page and the image used on your profile page.
FBML provides code that will pull your profile or logo picture to your fan page so you don’t have to link to it from a different server.
Here’s how you do it.
The fbml tag is fb:profile-pic and looks like the following:
<fb:profile-pic uid="629152408" linked="true" size="normal" />
The only required attribute is uid. This is the ID number for the profile or fan page. Locating the UID is easier said than done but, then this is Facebook ;-)
To get the uid for your profile photo go to your photos tab. Click on any photo. In the address bar in your web browser, the url will end with id=629152408. That number is the uid you use with the fbml profile pic code.
To get the uid for your fan page, click on the logo. The url in the address bar of your web browser will end with id=84300445447. That number is the uid.
Please note that in the above examples I have used my own uid’s. Your numbers will be different.
Other attributes for profile-pic are optional.
- uid – the id number for the profile or fan page (this is not optional)
- size – the size of the image. Values can be thumb (50px wide), small (100px wide), normal (200px wide), and square (50px by 50px). The default used is thumb is a size isn’t specified. If you want to set a specific size, use width and height, which are listed below.
- linked – makes the image link to the user’s profile. The default is true, which links to the page
- width – sets the width of the image in pixels
- height – sets the height of the image in pixels
As I was writing this it occurred to me that locating the uid is a pain. It used to be easier before you were able to get custom names. Does anyone know a better way? By the time the uid is located and used with the fbml code, an image probably could have been uploaded to a server and linked to on the custom page.
Anyway, that’s how to use fbml to display your profile picture or logo on a custom facebook fan page.
photo credit: atomicshark