image.rb

Path: app/models/image.rb
Last Update: Fri Nov 23 12:06:26 +1100 2007

Images are referred to as "Pictures" throughout the views. They could further be divided into Photos, Artworks, Documents etc. using STI if there was need to deal with these things in different ways.

Using the file_column plugin thumbnails, and a reduced size diplay image are automatically when the file is uploaded created. A customized hack on this plugin also converts any TIFFs into JPEGs so that they can be viewed in the browser. file_column is no longer supported and it would be worth thinking about moving to acts_as_attachment which is easier to maintain and customize.

The files are currently stored in the filesystem in public/images/url/ according to the default file_column locations.

schema.rb snippet:

  create_table "images", :force => true do |t|
    t.column "url",                  :string,   :null => false
    t.column "format",               :string
    t.column "type",                 :string
    t.column "description",          :text
    t.column "created_at",           :datetime
    t.column "updated_at",           :datetime
    t.column "recorded_on",          :date
    t.column "restriction",          :string
    t.column "original_format",      :string
    t.column "location_of_original", :string
    t.column "catalogue_ref",        :string
    t.column "width",                :integer
    t.column "height",               :integer
    t.column "copyright_notice_id",  :integer
  end

[Validate]