Class: Thumbnail3mf

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby3mf/thumbnail3mf.rb

Class Method Summary collapse

Class Method Details

.parse(doc, relationship_file) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/ruby3mf/thumbnail3mf.rb', line 3

def self.parse(doc, relationship_file)
  img_type = MimeMagic.by_magic(relationship_file.get_input_stream)
  Log3mf.context "Thumbnail3mf" do |l|
    l.fatal_error "thumbnail file must be valid image file", page: 10 unless img_type
    l.debug "thumbnail is of type: #{img_type}"
    l.error "Expected a png or jpeg thumbnail but the thumbnail was of type #{img_type}", page: 12 unless ['image/png', 'image/jpeg'].include? img_type.type
  end

end