Module: Ramaze::Helper::Photographs
- Defined in:
- lib/cortex_reaver/helper/photographs.rb
Overview
Helps display photographs
Instance Method Summary collapse
- #description_of(photo) ⇒ Object
-
#neat_time(rational) ⇒ Object
1/60 => ‘1/60th’.
Instance Method Details
#description_of(photo) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cortex_reaver/helper/photographs.rb', line 5 def description_of(photo) begin if exif = photo.exif description = '' description << photo.date.strftime('%m/%d/%Y') + ' ' # description << exif.make if exif.make description << ' ' + exif.model + ', ' if exif.model description << ' ' + exif.focal_length_in_35mm_film.to_i.to_s + 'mm' if exif.focal_length_in_35mm_film description << ' at ' + neat_time(exif.exposure_time) if exif.exposure_time description << ' F' + exif.f_number.to_f.to_s if exif.f_number else nil end rescue # File might not be available, or EXIF might be missing... return description end end |
#neat_time(rational) ⇒ Object
1/60 => ‘1/60th’
25 26 27 28 29 30 31 |
# File 'lib/cortex_reaver/helper/photographs.rb', line 25 def neat_time(rational) if rational.denominator == 1 rational.numerator.to_s + ' seconds' else "#{rational.numerator}/#{rational.denominator.ordinal.to_s} of a second" end end |