Class: Imagesorter::Categorizers::FileExifCategorizer

Inherits:
Object
  • Object
show all
Defined in:
lib/imagesorter/categorizers/file_exif_categorizer.rb

Instance Method Summary collapse

Instance Method Details

#process(file) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/imagesorter/categorizers/file_exif_categorizer.rb', line 6

def process(file)
  exif = EXIFR::JPEG.new(file.file)

  exif.to_hash.each do |key, value|
    file["exif.#{key}"] = value
  end

  time = exif.date_time
  return nil if time.nil?
  file.time = time
rescue
  nil
end