Module SequelImage
In: lib/ramaze/contrib/sequel/image.rb

Scaffold image models utilizing thumbnailing and Ramaze integration. Resizing is done by ImageScience.

Usage:

  class Avatar < Sequel::Model
    IMAGE = {
      # specifies many_to_one, will create relation and foreign key

      :owner => :User,

      # Remove original and thumbnails on Avatar#destroy

      :cleanup => true,

      # Algorithm to use in ImageScience
      #
      # * resize(width, height)
      #     Resizes the image to +width+ and +height+ using a cubic-bspline
      #     filter.
      #
      # * thumbnail(size)
      #     Creates a proportional thumbnail of the image scaled so its
      #     longest edge is resized to +size+.
      #
      # * cropped_thumbnail(size)
      #     Creates a square thumbnail of the image cropping the longest edge
      #     to match the shortest edge, resizes to +size+.

      :algorithm => :thumbnail,

      # Key specifies the filename and accessors, value are arguments to the
      # algorithm

      :sizes => {
        :small => 150,
        :medium => 300,
        :large => 600
      }
    }

    # Perform the scaffold
    include SequelImage
  end

Methods

included  

Classes and Modules

Module SequelImage::InstanceMethods
Module SequelImage::SingletonMethods

Public Class methods

[Validate]