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 .flexi views and a good effort to making it more MVC friendly.
Get Fleximage v2 hereSo 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 inheritance method 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. It’s new, it’s awesome, and has extensive documentation in the attached Wiki.
Lastly, if you are using Fleximage in an existing production site, please add it on the WhoUsesFleximage page. I know you’re out there.
by Genís