class FileData::Exif

Convenience class for extracting exif data from a file or stream

Public Class Methods

creation_date(input) click to toggle source
# File lib/file_data/formats/exif/exif.rb, line 35
def self.creation_date(input)
  raw_tag = FileData::Exif.only_image_tag(input, [34_665, 36_867])
  Time.strptime(raw_tag, '%Y:%m:%d %H:%M:%S') unless raw_tag.nil?
end
delegate_to_exif_reader(input, name, other_args) click to toggle source
# File lib/file_data/formats/exif/exif.rb, line 20
def self.delegate_to_exif_reader(input, name, other_args)
  streamify(input) do |stream|
    exif = ExifJpeg.new(stream).exif
    ExifReader.new(exif).send(name, *other_args)
  end
end
origin_date(input) click to toggle source
# File lib/file_data/formats/exif/exif.rb, line 40
def self.origin_date(input)
  creation_date(input)
end
streamify(input) { |f| ... } click to toggle source
# File lib/file_data/formats/exif/exif.rb, line 27
def self.streamify(input)
  if input.is_a?(String)
    ::File.open(input, 'rb') { |f| yield f }
  else
    yield input
  end
end