Meet Rack::UpsideDownTernet

One of my coworkers recently tweeted his interested in a Rack-compliant version of the upside-down-ternet. Inspired by the upcoming April Fools' Day, I took the challenge and created Rack::UpsideDownTernet. Check it out at GitHub!

Fun Stuff

Just like the original, this middleware downloads all the images on a page, transforms them with ImageMagick (-flip is the default transformation) and renders out the updated images. Pure. Simple. Fun.

Setup is just like any other middleware. Bonus: set your own image transformations!

# environment.rb
require 'rack_upside_down_ternet'
config.middleware.use Rack::UpsideDownTernet, '-blur 10 -flip'

Broken Stuff

  • Uses curl instead of just grabbing the file out of the images directory
  • Doesn't even kinda work with remote/absolute URL images
  • Requires unicorn (or any multi-worker setup). Make sure you have at least 2 workers running, as your first request will block curl from downloading images
  • Requires that you create PROJECT_DIR/tmp and PROJECT_DIR/images/mod
blog comments powered by Disqus