Class: Imagecache::Conversions::Round

Inherits:
Object
  • Object
show all
Defined in:
lib/imagecache/conversions/round.rb

Instance Method Summary collapse

Instance Method Details

#process(file, metadata, conversion) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/imagecache/conversions/round.rb', line 7

def process(file, , conversion)
  shortest = [.width, .height].min
  Rails.logger.debug(conversion.radius)
  Rails.logger.debug(shortest)
  radius = (conversion.radius / 100.to_f) * shortest
  command = command(file.path, radius)
  Rails.logger.debug(command)
  output = `#{command}`
  data = File.open("#{file.path}.png").read
  File.unlink("#{file.path}.png")
  File.unlink(file.path)
  data
end