Module | FileColumn::Magick
In: | lib/magick_file_column.rb

If you are using file_column to upload images, you can directly process the images with RMagick, a ruby extension for accessing the popular imagemagick libraries. You can find more information about RMagick at rmagick.rubyforge.org.

You can control what to do by adding a `:magick` option to your options hash. All operations are performed immediately after a new file is assigned to the file_column attribute.

To resize the uploaded image according to an imagemagick geometry string, just use the `:geometry` option:

       file_column :image, :magick => {:geometry => "800x600>"}

You can also create additional versions of your image, for example thumb-nails, like this:

       file_column :image, :magick => {:versions =>
         { "thumb" => "50x50", "medium" => "640x480>" }
       }

These versions can later be accessed via file_column’s suffix mechanism. So if the uploaded image was named "vancouver.jpg", you can access the additional versions like this:

       o.image("thumb") # produces ".../vancouver-thumb.jpg"
       o.image_relative_path("medium") # produces ".../vancouver-medium.jpg"

The same mechanism can be used in the `url_for_file_column` helper:

       <%= url_for_file_column "entry", "image", "thumb" %>

Note: You‘ll need the rmagick extension installed as a gem in order to use file_column’s rmagick integration.

[Validate]