ImageSizer
Added by Rasputnik
at October 12, 2009 13:58
GitHub stats:
watcher(s)
fork(s)
About
This middleware adds a header (‘X-Content-Dimensions’) to the http response when serving images, to tell you the dimensions of the image.
Current implementation uses JRuby, because I’m too old to be compiling RMagicks dependencies on my various OSes.
Usage
Just stick in the Rack chain , in front of a site with some images – it should work with static files and dynamically generated images, since it reads the response body directly.
Will only operate on mime-types you specify (PNG, GIF and JPEG by default, since that’s what I tested). You can override by passing an array of mime types to act on.
use Rack::Something
use ImageSizer, [‘image/whatever’]
use Rack::SomethingElse
etc.
