Install gem:
$ gem install light_resizer
And set it in config:
config.middleware.insert_before(Rack::Sendfile, LightResizer::Middleware, Rails.root)
For example we have image in public folder by next url:
example.com/images/kitten.jpg
Url of resized image will be:
example.com/images/light_resize/100x150/kitten.jpg
light_resizer will find /public/images/kitten.jpg and create light_resize with resized to size of 100x150px image.
Default resize doesn't crop image and fill new space with transparent background.
To crop image use 'crop' in url:
example.com/images/light_resize/crop/100x150/kitten.png