FQL:photo

From Facebook Developer Wiki (FbDevWiki.com)
Jump to: navigation, search

Query this table to return information about a photo.

If you need to get photos associated with a group or event, query the photo_tag table.

Contents

Columns

Highlighted rows are indexable / searchable and one is usually required in the WHERE portion of the query.

Name Type Description
pid string The ID of the photo being queried. The pid cannot be longer than 50 characters.

Note: Because the pid is a string, you should always wrap the pid in quotes when referenced in a query. The pid is unique only for a given user.

aid string The ID of the album containing the photo being queried. The aid cannot be longer than 50 characters.

Note: Because the aid is a string, you should always wrap the aid in quotes when referenced in a query. The aid is unique only for a given user.

owner int The user ID of the owner of the photo being queried.
src_small string The URL to the thumbnail version of the photo being queried. The image can have a maximum width of 75px and a maximum height of 225px. This URL may be blank.
src_small_height string Height of the thumbnail version, in px. This field may be blank.
src_small_width string Width of the thumbnail version, in px. This field may be blank.
src_big string The URL to the full-sized version of the photo being queried. The image can have a maximum width or height of 720px. This URL may be blank.
src_big_height string Height of the full-sized version, in px. This field may be blank.
src_big_width string Width of the full-sized version, in px. This field may be blank.
src string The URL to the album view version of the photo being queried. The image can have a maximum width or height of 130px. This URL may be blank.
src_height string Height of the album view version, in px. This field may be blank.
src_width string Width of the album view version, in px. This field may be blank.
link string The URL to the page containing the photo being queried.
caption string The caption for the photo being queried.
created time The date when the photo being queried was added.
modified time The date when the photo being queried was last modified.
object_id int The object_id of a photo on Facebook. Use the object_id to let users comment on a photo with the Comments API. (I'm guessing this means the Comment object of the Graph API --Wong 16:33, 23 February 2011 (UTC))

Examples

SELECT pid FROM photo WHERE aid IN ( SELECT aid FROM album WHERE owner=''$user_id'' ) ORDER BY created DESC LIMIT 1,42

Fetch the src_big field for a user's profile picture. As this particular URL does not exist in the user table, we first obtain the profile picture's pid from the album table (the profile picture is the same as the cover_pid for the album named "Profile Pictures").

SELECT src_big FROM photo WHERE pid IN 
   (SELECT cover_pid FROM album WHERE owner = $user_id AND name = 'Profile Pictures')

Notes: If the user can change the album name of the Profile Picture then the above will not work.

Notes/Bugs/Gotchas

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Graph API
FQL
Toolbox