Skip to content

Instantly share code, notes, and snippets.

View timbillstrom's full-sized avatar

Tim Billström timbillstrom

View GitHub Profile
@timbillstrom
timbillstrom / resize_nocrop_noscale
Created September 21, 2016 19:58 — forked from maxivak/resize_nocrop_noscale
Crop and resize an image using MiniMagick in Ruby on Rails. Two approaches.
def resize_nocrop_noscale(image, w,h)
w_original = image[:width].to_f
h_original = image[:height].to_f
if w_original < w && h_original < h
return image
end
# resize
image.resize("#{w}x#{h}")