Module: Magickly

Defined in:
lib/magickly.rb,
lib/magickly/app.rb,
lib/magickly/version.rb

Defined Under Namespace

Classes: App

Constant Summary

DEFAULT_PALETTE_COLOR_COUNT =
5
VERSION =
'2.0.2'

Class Method Summary collapse

Class Method Details

.dragonflyObject



25
26
27
# File 'lib/magickly.rb', line 25

def dragonfly
  @dragonfly
end

.process_image(image, options = {}) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/magickly.rb', line 37

def process_image(image, options={})
  options.each do |method, val|
    method = method.to_sym
    if Magickly.dragonfly.processor_methods.include?(method)
      if val == 'true'
        image = image.process method
      else
        image = image.process method, val
      end
    elsif Magickly.dragonfly.job_methods.include?(method)
      # note: might be an app-defined dragonfly shortcut
      image = image.send(method, val)
    end
  end
  
  image
end

.process_src(src, options = {}) ⇒ Object

Raises:

  • (ArgumentError)


29
30
31
32
33
34
35
# File 'lib/magickly.rb', line 29

def process_src(src, options={})
  raise ArgumentError.new("src needed") if src.blank?
  escaped_src = URI.escape(src)
  image = Magickly.dragonfly.fetch(escaped_src)
  
  process_image(image, options)
end