Sha256: 08c2c62a4d617ebcfb50739037f619ce388ae9f56341fc1e19211c616513d8a8

Contents?: true

Size: 858 Bytes

Versions: 9

Compression:

Stored size: 858 Bytes

Contents

module Ramaze
  module Helper
    # Helps display photographs
    module Photographs
      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 ' + exposure_time_to_s(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
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cortex-reaver-0.0.1 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.2 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.3 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.4 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.5 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.6 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.7 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.8 lib/cortex_reaver/helper/photographs.rb
cortex-reaver-0.0.9 lib/cortex_reaver/helper/photographs.rb