Permalink
Browse files

New method: photo_size returns Flickr::Photos::Size for the required …

…size

Signed-off-by: CommonThread <hotcommander@commonthread.com>
  • Loading branch information...
1 parent aefcfc0 commit eccde74c3f7458e222a36d854bcf11dbb279e1e0 @qnm qnm committed with commonthread Jul 6, 2009
Showing with 18 additions and 0 deletions.
  1. +18 −0 lib/flickr/photo.rb
View
@@ -24,6 +24,24 @@ def url(size = :medium)
image_url(size)
end
+ # returns an instance of Flickr::Photos::Size for the required size
+ #
+ # Params
+ # * size (Optional)
+ # the size of the size instance to return. Optional sizes are:
+ # :square - square 75x75
+ # :thumbnail - 100 on longest side
+ # :small - 240 on longest side
+ # :medium - 500 on longest side
+ # :large - 1024 on longest side (only exists for very large original images)
+ # :original - original image, either a jpg, gif or png, depending on source format
+ # Examples
+ # Photo.photo_size(:square).source
+ # Photo.photo_size(:large).width
+ def photo_size(size = :medium)
+ size_hash.fetch(size.to_s, size_hash['medium'])
+ end
+
# retreive the url to the image stored on flickr
#
# == Params

0 comments on commit eccde74

Please sign in to comment.