Search Flex Components Free

Custom Search

December 12, 2007


Hardly any web application this day won’t need file upload, mainly for all the media types, photos and videos. When using framework like Ruby on Rails, there are all kinds of plugins you can pick to speed up your development. For example, file upload, there are three major ones available. Which one you should go for? It’s actually a question harder than you thought.

These three file upload plugins are Acts As Attachment, File Column Plugin and FlexImage. The last one has nothing to do Flex, just you know. Before I start the review and comparison, I’d like say Ruby on Rails is great but documents from Ruby on Rails developers suck!

They all use RMagick to resize uploaded image and create multiple versions in different sizes.

Acts As Attachment

Written by Rick Olson, member of Ruby on Rails Core Team. It’s a very complete RoR plugin, in terms of testing and well structured code.

What I like:

The generator comes with it can generate model with metadata such as file size, content type, height and width, etc. The data will be populated at creation time automatically. The data structure also trace the relationship between main image and the thumbnail image via self reference attribute parent_id, a defaulting attribute name for RoR to allow out of box Acts As Tree behavior.
It allows you store file in file system or database blob, with reasonable default filesystem directory structure, to RAILS_ROOT/public/my_models/5/blah.jpg.
What I don’t like:

Have to read the source code to figure out how the file get stored. There is no way to configure the file storage place to be flexible. Some model method such public_filename has to be overwritten to make flexible location available.
File attachment validation is flicky.
File Column Plugin

The oldest and most used file upload plugin.

What I like:

There are ways to set custom file storage location. Good. You can do callback function at :store_dir option to make it fits exactly how you want the file get stored. The reason I’m asking for file storage flexibility is that once you know how to get file uploaded, uploading is trivial, however, managing files are big deal when you do expect large amount of files.
It provides view helper to generate image url for viewing.
Many RoR developers use it and provide feedback. Easier to find hacks or modifications.

This is relatively newer file upload plugin for RoR. It has build-in features to provide special effects on the image you present, via RMagick. It’s cool when you first see it and use it.

What I like:

The build-in special image overlays. It’ll help you branding your data.
It’s super easy to store image into BLOB column and retrieve it. Along with page caching, it could be great file management solution, if you like store file in DB.
What I don’t like:

Once file gets store, there is no metadata information. By default, your file name becomes the id.jpg. The original file name is not preserved unless you code something around this plugin, not very DRY.
No flexible way of store file into filesystem under custom directories. All files, if use file system, will be stored in one place. It’s practically unrealistic for site deal with lots of uploads.
We’ve been using FlexImage. Now I think we’ll switch back to File Column Plugin. As I mentioned earlier, uploading file is not a big deal once you get it works. You like to have the flexibility to efficiently manage the files on your server. Especially when you are expecting large amount of files coming in, when a more robust distributed file storage is under consideration, you really want to put the files to the right place earlier on. Another big challenge imposed to the site design is that file system or DB BLOB? I like file system but I’m sure there is good cases that DB BLOB works better.

Related Flex Tutorials