Class: Bulldog::Processor::ImageMagick

Inherits:
Base
  • Object
show all
Defined in:
lib/bulldog/processor/image_magick.rb

Class Attribute Summary collapse

Attributes inherited from Base

#attachment, #input_file, #style, #styles

Instance Method Summary collapse

Methods inherited from Base

#name, #output_file, #record, #value

Constructor Details

#initialize(*args) ⇒ ImageMagick

Returns a new instance of ImageMagick.



11
12
13
# File 'lib/bulldog/processor/image_magick.rb', line 11

def initialize(*args)
  super
end

Class Attribute Details

.convert_pathObject

Returns the value of attribute convert_path.



7
8
9
# File 'lib/bulldog/processor/image_magick.rb', line 7

def convert_path
  @convert_path
end

.identify_pathObject

Returns the value of attribute identify_path.



8
9
10
# File 'lib/bulldog/processor/image_magick.rb', line 8

def identify_path
  @identify_path
end

Instance Method Details

#dimensions(&block) ⇒ Object

Yield the dimensions of the generated file at this point in the pipeline.

The block is called when ‘convert’ is run after the processor block is evaluated for all styles. If you just need the dimensions of the input file, see Attribute::Photo#dimensions.



32
33
34
35
36
37
38
# File 'lib/bulldog/processor/image_magick.rb', line 32

def dimensions(&block)
  operate '-format', '%w %h'
  operate '-identify' do |styles, output|
    width, height = output.gets.split.map{|line| line.to_i}
    block.call(styles, width, height)
  end
end

#process(styles, options = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/bulldog/processor/image_magick.rb', line 15

def process(styles, options={})
  @tree = ArgumentTree.new(styles)
  super or
    return
  run_convert
end