com. kelvinluck. flickr. Photo

Class to describe a photo from Flickr.

Instances of this class are created to hold photos who have been returned in data from calls to the Flickr API.

Licence

This code and documentation is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0.  http://creativecommons.org/licenses/by-nc-sa/2.0/

Author

Kelvin Luck < kelvin at kelvinluck dot com >

Summary
Class to describe a photo from Flickr.
This photo’s id.
A reference to the Person who owns this photo.
This photo’s secret.
This photo’s server.
The format that this Photo was originally uploaded in.
This photo’s title.
This photo’s description.
The number of comments this photo has.
The Notes that have been left on this photo.
The Tags that are associated with this photo.
The PhotoSizes that are associated with this photo.
Whether or not this photo is public.
Whether or not this photo is by a friend.
Whether or not this photo is by a family member.
The date this photo was uploaded
The date this photo was taken.
The date this photo was uploaded
The link to this photo’s page on flickr.com.
The URL for the small sized image (240px on longest side)
The URL for the medium sized image (500px on longest side)
The URL for the large sized image (1024px on longest side)
The URL for this photo within the context of the photostream e.g.
The URL for this photo’s thumbnail image within some sort of context e.g.
The previous photo in this context (as returned by Flickr.photosGetContext)
The next photo in this context (as returned by Flickr.photosGetContext)
Not documented on flickr.com but maybe the number of photos in this context (e.g.
Stores information about this Photos context in given Photosets
Stores information about this Photos context in given Groups
An Array containing references to the Photosets that this Photo is in.
An Array containing references to the Groups that this Photo is in.
The EXIF/TIFF/GPS tags associated with this photo.
A private static Object containing Photo objects.
Returns an object containing all the note’s that have been left on this Photo
Adds a Note object to this Photo.
Returns an object containing all the tags’s that are associated with this Photo.
A utility function to get all the Tag’s associated with this Photo as Strings.
Adds a Tag object to this Photo and associates it with a Person who is the Person who associated that Tag with this Photo.
Set’s this Photo’s _tags...
Adds a photoset to this Photos _photosets Array
Removes a given Photoset from this Photos _photosets Array.
This Photos _photosets Array.
Adds a Group to this Photos _groups Array
Removes a given Group from this Photos _groups Array.
This Groups _groups Array.
Adds information about this Photos context in a given Photoset
Get information about the context of this Photo in a given Photoset
Adds information about this Photos context in a given Group
Get information about the context of this Photo in a given Photoset
Adds a PhotoSize object to this Photo.
Get’s information about the available PhotoSizes for this Photo (assuming Flickr.photosGetSizes has been called - otherwise returns an empty Array.
Get’s a Photo object for the given photo ID.

id

public var id: Number

This photo’s id.

owner

public var owner: Person

A reference to the Person who owns this photo.

secret

public var secret: String

This photo’s secret.

server

public var server: Number

This photo’s server.

originalFormat

public var originalFormat: String

The format that this Photo was originally uploaded in.

title

public var title: String

This photo’s title.

description

public var description: String

This photo’s description.

numComments

public var numComments: Number

The number of comments this photo has.

notes

private var _notes: Object

The Notes that have been left on this photo.  Private so access through the functions below.

See Also

getNotes

addNote

_tags

var _tags: Object

The Tags that are associated with this photo.  Private so access through the functions below.

See Also

getTags

addTag

_sizes

private var _sizes: Array

The PhotoSizes that are associated with this photo.

See Also

addSize

isPublic

public var isPublic: Boolean

Whether or not this photo is public.

isFriend

public var isFriend: Boolean

Whether or not this photo is by a friend.

isFamily

public var isFamily: Boolean

Whether or not this photo is by a family member.

dateUploaded

private var _dateUploaded: Date

The date this photo was uploaded

You set this as a String which the setter method automagically transforms from a UNIX Timestamp (as provided by flickr.com) to a Date object.

dateTaken

private var _dateTaken: Date

The date this photo was taken.

You set this as a string which the setter method automagically transforms from a MySQL Timestamp (as provided by flickr.com) to a Date object.

dateUpdated

private var _dateUpdated: Date

The date this photo was uploaded

You set this as a String which the setter method automagically transforms from a UNIX Timestamp (as provided by flickr.com) to a Date object.

licence

public var licence: Number

rotation

public var rotation: Number

photoPageUrl

private var _photoPageUrl: String

The link to this photo’s page on flickr.com.  If flickr.photos.getInfo has been called on this photo then the link will be the “pretty” one with the user’s chosen screen name.  Otherwise it will be the “ugly” one which works just as well but doesn’t look as good.

thumbnailUrl

private var _thumbnailUrl: String
The URL for the thumbnail image representing this <Photo>.  *NOTE*This is the 75 x 75 pixel thumbnail image refered to as “small square” in the flickr.com documentation not the 100 pixels on the longest side image called “thumbnail” in the flickr.com documentation.  Why?  For consistancy after an inital mistake on my part!

smallUrl

public function set smallUrl(smallUrl: String)

The URL for the small sized image (240px on longest side)

mediumUrl

public function set mediumUrl(mediumUrl: String)

The URL for the medium sized image (500px on longest side)

largeUrl

public function set largeUrl(largeUrl: String)

The URL for the large sized image (1024px on longest side)

originalUrl

private var _originalUrl: String
The URL for the originally uploaded imagereturns an empty string if we don’t know the format of the original image.

contextUrl

public var contextUrl: String

The URL for this photo within the context of the photostream e.g. as returned from a call to flickr.photo.getContext

contextThumbUrl

public var contextThumbUrl: String

The URL for this photo’s thumbnail image within some sort of context e.g. as returned from a call to flickr.photo.getContext TODO: The thumbnail URL should be independant of context, no?

contextPhotoPrevious

public var contextPhotoPrevious: Photo

The previous photo in this context (as returned by Flickr.photosGetContext)

contextPhotoNext

public var contextPhotoNext: Photo

The next photo in this context (as returned by Flickr.photosGetContext)

contextCount

public var contextCount: Number

Not documented on flickr.com but maybe the number of photos in this context (e.g. the user’s photostream)?  (as returned by <Flickr.photoGetContext>)

contextPhotosets

var contextPhotosets: Object

Stores information about this Photos context in given Photosets

See Also

Flickr.photosetsGetContext

getContextPhotoset

setContextPhotoset

contextGroupPool

var contextGroupPools: Object

Stores information about this Photos context in given Groups

See Also

Flickr.groupsPoolsGetContext

getContextGroupPool

setContextGroupPool

_photosets

private var _photosets: Array

An Array containing references to the Photosets that this Photo is in.  Filled in by a call to Flickr.photosGetAllContexts and also when you e.g. add a Photo to a Photoset through Photoset.addPhoto or Flickr.photosetsEditPhotos

See Also

addPhotoset

removePhotoset

getPhotosets

_groups

var _groups: Array

An Array containing references to the Groups that this Photo is in.  Filled in by a call to Flickr.photosGetAllContexts and also when you e.g. add a Photo to a Group through Group.addPhoto

See Also

addGroup

removeGroup

getGroups

exifData

public var exifData: Array

The EXIF/TIFF/GPS tags associated with this photo.  It is an Array of ExifData objects.

_photos

private static var _photos: Object

A private static Object containing Photo objects.  Used by getPhoto to insure that only one Photo is created for each photo ID returned from flickr.com

Photo

private function Photo(id: Number)
Constructor functioncreates a new Photo object.

Should be called via Photo.getPhoto

getNotes

function getNotes():Object

Returns an object containing all the note’s that have been left on this Photo

Returns

All the Note’s that have been left on this Photo

See Also

<_notes>

Flickr.photosGetInfo

addNote

function addNote(note: Note):Void

Adds a Note object to this Photo.

Parameters

noteThe Note you want to add to this photo

getTags

function getTags():Object

Returns an object containing all the tags’s that are associated with this Photo.

Returns

All the Tag’s that are associated with this Photo.  Each Tag is associated with a Person as well &ndash; the Person who left this Tag on this Photo.  Each Tag is also associated with an id &ndash; this is the number you would use to call Flickr.photosRemoveTag if you wanted to remove that Tag from this Photo.

See Also

_tags

getTagsAsStrings

Flickr.photosGetInfo

getTagsAsStrings

function getTagsAsStrings():Array

A utility function to get all the Tag’s associated with this Photo as Strings.  Use this in cases where you don’t care about the details of the Tag or it’s relationship to this Photo (e.g. you aren’t planning to modify it or delete it) and you just want to know what it is...

Returns

An Array containing the clean version of the text for each Tag left on this Photo.  NOTE: this is only useful to you if you are only interested in the textual content of these Tags (otherwise use getTags) and will only be filled after a call to Flickr.photosGetInfo for this Photo.

See Also

_tags

getTags

Flickr.photosGetInfo

addTag

function addTag(id: Number,
tag: Tag,
author: Person):Void

Adds a Tag object to this Photo and associates it with a Person who is the Person who associated that Tag with this Photo.

Parameters

idThe id which describes the link between this Photo and Tag.
tagThe Tag you want to add to this photo.
authorThe Person who attached that Tag to this Photo.

See Also

_tags

getTags

setTags

function setTags(tags: String,
author: Person)

Set’s this Photo’s _tags...

Parameters

tagsThe tags to add to this photo...
authorThe Person who added these tags (leave blank if you don’t know)

TODO

Doesn’t deal properly with tags with spaces in the name now :(

Also need to get the Person object for the logged in user so we can correctly associate the author with the tag...

We don’t know the id’s that will associate the Tag’s with the Photos at this point so are using garbage ones.  This means that you won’t be able to remove the tags using those ids...

addPhotoset

function addPhotoset(photoset: Photoset)

Adds a photoset to this Photos _photosets Array

Parameters

photosetThe Photoset to add to this Photo.

removePhotoset

function removePhotoset(photoset: Photoset)

Removes a given Photoset from this Photos _photosets Array.

getPhotosets

function getPhotosets():Array

Returns

This Photos _photosets Array.

See Also

_photosets

addGroup

function addGroup(group: Group)

Adds a Group to this Photos _groups Array

Parameters

groupThe Group to add to this Photo.

removeGroup

function removeGroup(group: Group)

Removes a given Group from this Photos _groups Array.

getGroups

function getGroups():Array

Returns

This Groups _groups Array.

See Also

_groups

setContextPhotoset

function setContextPhotoset(photosetId: Number,
previousPhoto: Photo,
nextPhoto: Photo)

Adds information about this Photos context in a given Photoset

Parameters

photosetIdThe id of the Photoset this context is for
previousPhotoThe Photo before this Photo in this context or undefined if this is the first Photo in this context.
nextPhotoThe Photo after this Photo in this context or undefined if this is the last Photo in this context.

getContextPhotoset

function getContextPhotoset(photosetId: Number)

Get information about the context of this Photo in a given Photoset

Parameters

photosetIdThe id of the Photoset you want the context information for.

Returns

An object containing nextPhoto and previousPhoto which are Photo objects. undefined if there is no information about this Photos context in the requested Photoset

setContextGroupPool

function setContextGroupPool(groupId: String,
previousPhoto: Photo,
nextPhoto: Photo)

Adds information about this Photos context in a given Group

Parameters

groupIdThe id of the Group this context is for
previousPhotoThe Photo before this Photo in this context or undefined if this is the first Photo in this context.
nextPhotoThe Photo after this Photo in this context or undefined if this is the last Photo in this context.

getContextGroupPool

function getContextGroupPool(groupId: Number)

Get information about the context of this Photo in a given Photoset

Parameters

groupIdThe id of the Group you want the context information for.

Returns

An object containing nextPhoto and previousPhoto which are Photo objects. undefined if there is no information about this Photos context in the requested Group

addSize

function addSize(size: PhotoSize):Void

Adds a PhotoSize object to this Photo.

Parameters

sizeThe PhotoSize you want to add to this photo.

getSizes

function getSizes():Array

Get’s information about the available PhotoSizes for this Photo (assuming Flickr.photosGetSizes has been called - otherwise returns an empty Array.

See Also

_sizes

Flickr.photosGetSizes

Returns : The _sizes Array.

getPhoto

public static function getPhoto(photoId: Number):Photo

Get’s a Photo object for the given photo ID.

Consults _photos to make sure that only one Photo instance is created for each photo ID from flickr.com

Parameters

photoIdThe id of the Photo you want to get

Returns

The Photo object for te given id

public var id: Number
This photo’s id.
public var owner: Person
A reference to the Person who owns this photo.
Class to describe a person from Flickr.
public var secret: String
This photo’s secret.
public var server: Number
This photo’s server.
public var originalFormat: String
The format that this Photo was originally uploaded in.
private function Photo(id: Number)
public var title: String
This photo’s title.
public var description: String
This photo’s description.
public var numComments: Number
The number of comments this photo has.
private var _notes: Object
The Notes that have been left on this photo.
Class to describe a note on a photo on Flickr.
var _tags: Object
The Tags that are associated with this photo.
Class to describe a tag on a photo on flickr.com
private var _sizes: Array
The PhotoSizes that are associated with this photo.
Class to describe the size of a Photo from Flickr.
public var isPublic: Boolean
Whether or not this photo is public.
public var isFriend: Boolean
Whether or not this photo is by a friend.
public var isFamily: Boolean
Whether or not this photo is by a family member.
private var _dateUploaded: Date
The date this photo was uploaded
private var _dateTaken: Date
The date this photo was taken.
private var _dateUpdated: Date
The date this photo was uploaded
public var licence: Number
public var rotation: Number
private var _photoPageUrl: String
The link to this photo’s page on flickr.com.
private var _thumbnailUrl: String
public function set smallUrl(smallUrl: String)
The URL for the small sized image (240px on longest side)
public function set mediumUrl(mediumUrl: String)
The URL for the medium sized image (500px on longest side)
public function set largeUrl(largeUrl: String)
The URL for the large sized image (1024px on longest side)
private var _originalUrl: String
public var contextUrl: String
The URL for this photo within the context of the photostream e.g.
public var contextThumbUrl: String
The URL for this photo’s thumbnail image within some sort of context e.g.
public var contextPhotoPrevious: Photo
The previous photo in this context (as returned by Flickr.photosGetContext)
function photosGetContext (photoId: Number)
Calls flickr.photos.getContext to return next and previous photos for a photo in a photostream.
public var contextPhotoNext: Photo
The next photo in this context (as returned by Flickr.photosGetContext)
public var contextCount: Number
Not documented on flickr.com but maybe the number of photos in this context (e.g.
var contextPhotosets: Object
Stores information about this Photos context in given Photosets
Describes a Photoset on flickr.com
var contextGroupPools: Object
Stores information about this Photos context in given Groups
Class to describe a group from Flickr.
private var _photosets: Array
An Array containing references to the Photosets that this Photo is in.
var _groups: Array
An Array containing references to the Groups that this Photo is in.
public var exifData: Array
The EXIF/TIFF/GPS tags associated with this photo.
private static var _photos: Object
A private static Object containing Photo objects.
function getNotes():Object
Returns an object containing all the note’s that have been left on this Photo
function addNote(note: Note):Void
Adds a Note object to this Photo.
function getTags():Object
Returns an object containing all the tags’s that are associated with this Photo.
function getTagsAsStrings():Array
A utility function to get all the Tag’s associated with this Photo as Strings.
function addTag(id: Number,
tag: Tag,
author: Person):Void
Adds a Tag object to this Photo and associates it with a Person who is the Person who associated that Tag with this Photo.
function setTags(tags: String,
author: Person)
Set’s this Photo’s _tags...
function addPhotoset(photoset: Photoset)
Adds a photoset to this Photos _photosets Array
function removePhotoset(photoset: Photoset)
Removes a given Photoset from this Photos _photosets Array.
function getPhotosets():Array
This Photos _photosets Array.
function addGroup(group: Group)
Adds a Group to this Photos _groups Array
function removeGroup(group: Group)
Removes a given Group from this Photos _groups Array.
function getGroups():Array
This Groups _groups Array.
function setContextPhotoset(photosetId: Number,
previousPhoto: Photo,
nextPhoto: Photo)
Adds information about this Photos context in a given Photoset
function getContextPhotoset(photosetId: Number)
Get information about the context of this Photo in a given Photoset
function setContextGroupPool(groupId: String,
previousPhoto: Photo,
nextPhoto: Photo)
Adds information about this Photos context in a given Group
function getContextGroupPool(groupId: Number)
Get information about the context of this Photo in a given Photoset
function addSize(size: PhotoSize):Void
Adds a PhotoSize object to this Photo.
function getSizes():Array
Get’s information about the available PhotoSizes for this Photo (assuming Flickr.photosGetSizes has been called - otherwise returns an empty Array.
function photosGetSizes (photoId: Number)
Calls flickr.photos.getRecent to get the available sizes for a photo.
public static function getPhoto(photoId: Number):Photo
Get’s a Photo object for the given photo ID.
function photosetsGetContext(photoId: Number,
photosetId: Number)
Returns next and previous photos for a photo in a set.
function groupsPoolsGetContext(photoId: Number,
groupId: String)
Gets next and previous photos for a photo in a group pool.
function photosGetAllContexts(photoId: Number)
Returns all visble sets and pools the photo belongs to.
function addPhoto(photo: Photo)
Adds a photo to the end of this Photoset’s photos array and updates numPhotos Called internally on a successful response from flickr.photosets.addPhoto.
function photosetsEditPhotos(photosetId: Number,
primaryPhotoId: Number,
photoIds: Array)
Modify the photos in a photoset.
function addPhoto(photo: Photo)
Adds a Photo to this Groups _pool.
Class to describe some ExifData as returned by Flickr.
function photosGetInfo (photoId: Number,
secret: String)
Calls flickr.photos.getInfo to get information about a photo..
function photosRemoveTag (tagId: Number)
Calls flickr.photos.removeTag to remove a tag from a photo.