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.

Currently very bare bones - this class will be expanded as I program the interaction with the flickr.photos.* Flikr API calls

Version

0.1.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.
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 URL for this photo within some sort of context 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? 
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.
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 PhotoSize object to this Photo.
Get’s a Photo object for the given photo ID.

Variables

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.

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

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

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

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.

licence

public var licence: Number

rotation

public var rotation: Number

contextUrl

public var contextUrl: String

The URL for this photo within some sort of context 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

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?  (as returned by <Flickr.photoGetContext>)

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

Functions

Photo

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

Should be called via <PhotoManager.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 wellthe Person who left this Tag on this Photo.  Each Tag is
also associated with an idthis is the number you would use to call Flickr.photosRemoveTag if you wanted to remove that Tag from this Photo.

See Also

_tags

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)

Set’s this Photo’s _tags...

Parameters

tagsThe tags to add to this photo...

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...

addSize

function addSize(size: PhotoSize):Void

Adds a PhotoSize object to this Photo.

Parameters

sizeThe PhotoSize you want to add to this photo.

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
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 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.
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.
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.
public var licence: Number
public var rotation: Number
public var contextUrl: String
The URL for this photo within some sort of context 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? 
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.
private function Photo(id: Number)
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 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)
Set’s this Photo’s _tags...
function addSize(size: PhotoSize):Void
Adds a PhotoSize object to this Photo.
public static function getPhoto(photoId: Number):Photo
Get’s a Photo object for the given photo ID.
Class to describe some ExifData as returned by Flickr.
function photosGetInfo (photoId: Number,
secret: Number)
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.