Fleximage is a Rails plugin that tries to make image uploading and
rendering super easy.
Get Fleximage v2 here
You ever make something, and then look back a few years later and say
“What the hell was I thinking”? This happened to me recently.
Fleximage has been quite a useful plugin for me, but under the hood it
was a mess; the API was cumbersome, and mixing in all the image
transformations as direct model methods was code smell.
This release represents the 3rd complete rewrite of this code base. The
first effort was SuperImage. It worked, but it happened almost entirely
in the controller and made more interesting effects harder. The first
Fleximage was next introducing more tranformations and @[email protected] views
and a good effort to making it more MVC friendly.
So I now present, Fleximage v2. The output is very similar, but the
API and internals are completely different. Here’s some highlights.
- No support for DB stored images, sorry…
- Creation date based master image storage to prevent OS imposed
directory limits. i.e. /path/to/images/2008/02/06/999.jpg
- Rails 2 formatted resource route friendly
- Magic columns to capture filename and image size
- Image transformation methods are not injected into your model or
controller at all.
- Image operations now happen via Operator class that refactor each
transformation into their own encapsulated class.
- Easily output JPG, PNG, or GIF based on request format.
- Simple acts_as_* style model activation rather than using a cumbersome
- Side by side file upload or URL fields for easy uploading.
- Uploading will only ever replace you image file if the uploaded file
actually has content, removing the need for “if file.size > 0” nonsense
in your controller.
- Rake tasks to convert from master image directory styles, as well as
master image formats (jpg => png for instance)
And it’s all hosted on “GitHib”:http://github.com/Squeegy/fleximage.
It’s new, it’s awesome, and has extensive documentation in the attached
Lastly, if you are using Fleximage in an existing production site,
please add it on the
page. I know you’re out there.
Enjoy, and I would love any feedback anyone has on it!