Skip to content
Squeegy edited this page Sep 12, 2010 · 3 revisions

Fleximage is a Rails plugin that tried to make image uploading and rendering super easy.

There are 2 pieces involved in making Rails image handling easy.

Image Uploads

In this post Rails 2, resource driven world, Fleximage believes that images should belong directly to a record. So you simply tell your model have to tell your model class to act as Fleximage, and your model effortlessly gains the ability to handle file uploads.

  • Your model gains the ability to interface directly with a file_field form, allowing uploads with zero extra controller or model code.
  • Accept uploads form a web address, pulling in the image form the internet and saving it locally.
  • Image presence validation with a customizable form field errors message.
  • Image format validation that will not allow the file to be uploaded unless RMagick can parse it into useable image data.
  • Image pre-processing to keep uploaded images under a certain size, or other on-upload image processing tasks.

Image Rendering

The other half of the problem comes from the need to send the uploaded images back to the web browser. Most of the time, you need to display the image in different sizes or formats in different places on your site. For example, a product image in a store may need a square thumbnail image, a medium image for its focus page, and a large image for an “enlarge this photo”, popup.

Fleximage uses a simple templating engine that allows you to re-render images exactly how you need them. Using the same “master image”, many images can be rendered from the same source. You can even go beyond resizing; there is support for image overlays, text drawing, drop shadows, borders and more. The rendering engine is flexible and extensible to whatever your dynamic image needs are.

  • Renderer implemented as template engine, which fits in perfectly with Rails 2 RESTful style format sensitive views.
  • Does not need to have everything resized on upload allowing your site layout the change later on, and all image will re-render themselves just right with your new rendering templates.
  • Support for special effects like text, image or logo overlays, borders, shadows.
  • Extensible by adding image operator classes which allow for reusable snippets of direct RMagick code.
  • Require absolutely zero controller code.

Get Started

See the GettingStarted section to take you first steps with this plugin.

Clone this wiki locally