This is a ruby port of Adaptive-Images (http://adaptive-images.com/, originally by Matt Wilcox). It does not contain all features, but it does more or less the same in the same way. It uses ImageMagick (via mini_magick) in stead of GD.
It runs as a sinatra application that can be mounted using Rack.
gem install rai
Put something like this in your config.ru:
require 'rai'
map '/images' do
Rai::App.set :img_path, '/path/to/your/images'
Rai::App.set :cache_path, '/path/to/your/cache'
run Rai::App
end
Keep an eye on the cache to see if it needs updating.
Values: true/false
Default: true
Resolution break-points (screen widths).
Value: array
Default: [2560, 1920, 1440, 1024, 768, 480]
JPG compression ratio, 0-100.
Value: integer, 0-100
Default: 85
Wether image should be sharpened or not.
Value: true/false
Default: true
Browser cache TTL
Value: integer, seconds
Default: 606024*7 (7 days)
Where images are placed.
Value: string, path
Default:File.join(File.dirname(FILE), '..', 'images')
Where cached versions are placed.
Value: string, path
Default: File.join(File.dirname(FILE), '..', 'images', 'rai-cache')
The name of the resolution cookie.
Value: string
Default: rai-resolution
Kim Nørgaard jasen@jasen.dk