Class: FilterRename::ImageFilename

Inherits:
Filename
  • Object
show all
Defined in:
lib/filter_rename/filetype/image_filename.rb

Overview

Image files tags handling.

Instance Attribute Summary

Attributes inherited from Filename

#original

Instance Method Summary collapse

Methods inherited from Filename

#!=, #==, #calculate_hash, #custom?, #diff, #exists?, #filename, #full_filename, #full_path, #get_string, #pretty_size, #rename!, #set_string, #target?, #targets, #values, #writable?, writable_tags?

Constructor Details

#initialize(fname, cfg) ⇒ ImageFilename

Returns a new instance of ImageFilename.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/filter_rename/filetype/image_filename.rb', line 11

def initialize(fname, cfg)
  super

  image = FastImage.new(fname)
  @width = image.size[0].to_s
  @height = image.size[1].to_s

  [@width, @height].map(&:readonly!)

  load_image_data(fname) if cfg.
end

Instance Method Details

#load_image_data(fname) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/filter_rename/filetype/image_filename.rb', line 23

def load_image_data(fname)
  image = Exiv2::ImageFactory.open(fname)
  image.

  return if image.exif_data.nil?

  image.exif_data.each do |key, value|
    (key, value, true)
  end
end