Project

rai

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby-port of Adaptive Images (http://adaptive-images.com/)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Ruby Adaptive-Images

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.

Installation

gem install rai

Configuration

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

Settings

:watch_cache

Keep an eye on the cache to see if it needs updating.

Values: true/false

Default: true

:resolutions

Resolution break-points (screen widths).

Value: array

Default: [2560, 1920, 1440, 1024, 768, 480]

:jpg_quality

JPG compression ratio, 0-100.

Value: integer, 0-100

Default: 85

:sharpen

Wether image should be sharpened or not.

Value: true/false

Default: true

:cache_max_age

Browser cache TTL

Value: integer, seconds

Default: 606024*7 (7 days)

:img_path

Where images are placed.

Value: string, path

Default:File.join(File.dirname(FILE), '..', 'images')

:cache_path

Where cached versions are placed.

Value: string, path

Default: File.join(File.dirname(FILE), '..', 'images', 'rai-cache')

:cookie_name

The name of the resolution cookie.

Value: string

Default: rai-resolution

Author

Kim Nørgaard jasen@jasen.dk