Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
    • Dialogs
    • FQL
    • Internationalization
    • Ads API
    • Credits
    • Chat API
    • Legacy REST API
    • Legacy FBML
    • Legacy FBJS
    • Legacy Javascript SDK
  • SDK Reference
  • Tools
  • Tables
    • album
    • application
    • apprequest
    • checkin
    • comment
    • comments_info
    • connection
    • cookies
    • developer
    • domain
    • domain_admin
    • event
    • event_member
    • family
    • friend
    • friend_request
    • friendlist
    • friendlist_member
    • group
    • group_member
    • insights
    • like
    • link
    • link_stat
    • location_post
    • mailbox_folder
    • message
    • note
    • notification
    • object_url
    • offer
    • page
    • page_admin
    • page_blocked_user
    • page_fan
    • page_milestone
    • permissions
    • permissions_info
    • photo
    • photo_src
    • photo_tag
    • place
    • privacy
    • privacy_setting
    • profile
    • profile_view
    • question
    • question_option
    • question_option_votes
    • review
    • standard_friend_info
    • standard_user_info
    • status
    • stream
    • stream_filter
    • stream_tag
    • subscription
    • thread
    • translation
    • unified_message
    • unified_thread
    • unified_thread_action
    • unified_thread_count
    • url_like
    • user
    • video
    • video_tag

photo_tag

Advanced Topics › FQL › photo_tag

A photo tag as represented in FQL.

The Photo object has an equivalent tags connection.

Note: Both object_id and pid uniquely identify a photo, and object_id is the preferred column to use.

To read the photo_tag table you need the following permissions:

User:

  • user_photos permissions to access photo tag information that a user is tagged in.
  • friends_photos permissions to access photo tag information that a friend is tagged in.

Group:

  • any valid access_token to access photo tags of a public group.
  • user_photos permissions to access photo tags of a user for a non-public group that the current user is a member of.
  • friends_photos permissions to access photo tags of a friend for a non-public group that the current user is a member of.

Event:

  • any valid access_token to access photo tags of a public event.
  • user_photos permissions to access photo tags of a user for a non-public event that the current user has been invited to. If the invited user removes the event from their list they will no longer be able to read the table.
  • friends_photos permissions to access photo tags of a friend for a non-public event that the current user has been invited to. If the invited user removes the event from their list they will no longer be able to read the table.

Note: You can also use the photo_tag FQL table to query for photos associated with a group (given its gid) or event (given its eid). See below for sample queries on how to do this.

Columns

IndexableNameTypeDescription
*object_idint

The object_id of the photo being queried. Preferred over pid.

*pidstring

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.

*subjectint

For tagged users, use the user ID of the subject for the tag being queried. For photos associated with events or groups, use the eid or gid for subject.

textstring

The content of the tag being queried. It contains either the name of the user tagged or the text tag.

xcoordfloat

The center of the tag's horizontal position, measured as a floating-point percentage from 0 to 100, from the left edge of the photo.

ycoordfloat

The center of the tag's vertical position, measured as a floating-point percentage from 0 to 100, from the top edge of the photo.

createdtime

The date that the tag being queried was created.

Examples

Get all tags for a photo associated with a user, given a photo id (pid).

SELECT text FROM photo_tag WHERE pid ='$pid'

Get all pids of photos associated with a user, given its user id (uid).

SELECT pid FROM photo_tag WHERE subject=$uid

Get all pids of photos associated with an event, given its event id (eid).

SELECT pid FROM photo_tag WHERE subject=$eid

Get all pids of photos associated with a group, given its group id (gid).

SELECT pid FROM photo_tag WHERE subject=$gid
Updated about 2 months ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy