lib/rails_uploads/magick/image.rb in rails_uploads-0.1.5 vs lib/rails_uploads/magick/image.rb in rails_uploads-0.2.0
- old
+ new
@@ -31,11 +31,11 @@
success
end
end
def dimensions
- identify(:format => '%wx%h') do |success, output|
+ identify(format: '%wx%h') do |success, output|
success ? output.chomp.split('x').map(&:to_i) : []
end
end
def width
@@ -47,16 +47,16 @@
end
def resize_to_fill(max_width, max_height)
width, height = dimensions
scale = [max_width/width.to_f, max_height/height.to_f].max
- convert :resize => "#{(scale*width).to_i}x#{(scale*height).to_i}", :gravity => 'center', :crop => "#{max_width}x#{max_height}+0+0"
+ convert resize: "#{(scale*width).to_i}x#{(scale*height).to_i}", gravity: 'center', crop: "#{max_width}x#{max_height}+0+0"
end
def resize_to_fit(max_width, max_height)
width, height = dimensions
scale = [max_width/width.to_f, max_height/height.to_f].min
- convert :resize => "#{(scale*width).to_i}x#{(scale*height).to_i}", :gravity => 'center'
+ convert resize: "#{(scale*width).to_i}x#{(scale*height).to_i}", gravity: 'center'
end
protected
def convert?