Archive for July, 2007

Outputting resized attachment_fu image, stored in database, with RMagick

Tuesday, July 10th, 2007

I have recently started using attachment_fu plugin to store attachments (including images, of course) in database. attachment_fu provides functionality to create thumbnail images during upload, but you can't really foresee what thumbnail sizes you will need down the road, can't you?

That's why I decided not to make any thumbnails at all during the upload stage (except for basic resizing so I will not end up with 4K-pixels images in database.

I store all the images in database (easier to migrate, easier to backup) , which adds some level of complixity when you try to output stuff to the user.

Having all that, I wanted to be able to easily output page_cachable resized images. Here's how I have implemented it. (more…)