Sha256: e3ff3cc5e31e68ec5717670e89a5eb9768b864c940e8d895b917ddd7cef6b533
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
module Riiif class File attr_reader :path class_attribute :info_extractor_class self.info_extractor_class = ImageMagickInfoExtractor # @param input_path [String] The location of an image file def initialize(input_path, tempfile = nil) @path = input_path @tempfile = tempfile # ensures that the tempfile will stick around until this file is garbage collected. end def self.read(stream, ext) create(ext) do |f| while chunk = stream.read(8192) f.write(chunk) end end end deprecation_deprecate read: 'Riiif::File.read is deprecated and will be removed in version 2.0' def self.create(ext = nil, _validate = true, &block) tempfile = Tempfile.new(['mini_magick', ext.to_s.downcase]) tempfile.binmode block.call(tempfile) tempfile.close image = new(tempfile.path, tempfile) ensure tempfile.close if tempfile end deprecation_deprecate create: 'Riiif::File.create is deprecated and will be removed in version 2.0' # @param [Transformation] transformation def extract(transformation) command = command_factory.build(path, transformation) execute(command) end def info @info ||= info_extractor_class.new(path).extract end delegate :execute, to: Riiif::CommandRunner private :execute private def command_factory ImagemagickCommandFactory end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
riiif-1.7.1 | app/models/riiif/file.rb |
riiif-1.7.0 | app/models/riiif/file.rb |
riiif-1.6.0 | app/models/riiif/file.rb |