Photo (FQL)

From Facebook Developer Wiki

Jump to: navigation, search


Contents

Description

The FQL photo table. Query this table to return information about a photo.

To structure your query, use the table name (photo in this case) in the FROM clause. The items in the Name column correspond to columns in the table that can be referenced in the SELECT and WHERE clauses.

In order to make your query indexable, the WHERE in your query should contain an = or IN clause for one of the columns marked with a * in the Indexable column of the table.

The See Also section lists API functions that work on similar data; their documentation pages contain additional information about the contents of the column and example FQL queries.

Need to get photos associated with a group or event? Use the Photo_tag_(FQL) table.

Columns

IndexableNameTypeDescription
* 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.
* 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.
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 604px. 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.

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.

See Also

reference