Getting an Object's Main Picture

For any object with a profile graphic (for example, profiles, pages, events, and groups), you can call the picture selector to return the binary representation of that graphic. Then, by calling Graph API in an <img> tag, you can display that image for others to see. You can also download the image by just doing an HTTP GET on the URL.

To get the main profile graphic for dummiesbook and display it on a Web page, you would include an image tag like this:

<img src="https://graph.facebook.com/dummiesbook/picture" border="0"
               alt="Facebook Application Development For Dummies" width="50"
               height="50" />

Because you specified a width and a height, it will size the image down to those dimensions.

image When you're calling the picture selector, you may also want to use the type property. By specifying type, you can tell Facebook to give you the prerendered size of the picture you want to display. The three sizes are as follows:

  • square: Renders a 50 x 50 pixel version of the profile image. This is the “thumbnail” version of the image that users can select on Facebook.
  • small: Renders a 50-pixel-wide version of the profile image, but dynamically adjusts the height of the image depending on scale.
  • large: Renders an “about” 200-pixel-wide version of the profile image (Facebook says “about”; I'm not sure what that means) and dynamically scales the height by that measurement. ...

Get Facebook® Application Development For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.