14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/pixage/images/convert.rb', line 14
def resize_images(images,options={:resize => "desc", :force => "false"})
expected = MiniMagick::Image.new(images[:expected])
actual = MiniMagick::Image.new(images[:actual])
switch = 0
if options[:resize]=="desc"
switch = expected.dimensions <=> actual.dimensions
elsif options[:resize]=="asc"
switch = actual.dimensions <=> expected.dimensions
end
case switch
when 1
if options[:force]=="true"
expected.resize(actual.dimensions.join('x')+"!")
else
expected.resize(actual.dimensions.join('x'))
end
when -1
if options[:force]=="true"
actual.resize(expected.dimensions.join('x')+"!")
else
actual.resize(expected.dimensions.join('x'))
end
end
end
|