Class Paperclip::Thumbnail
In: lib/paperclip/thumbnail.rb
Parent: Processor

Handles thumbnailing images that are uploaded.

Methods

Constants

ANIMATED_FORMATS = %w(gif)   List of formats that we need to preserve animation

Attributes

animated  [RW] 
convert_options  [RW] 
current_geometry  [RW] 
format  [RW] 
source_file_options  [RW] 
target_geometry  [RW] 
whiny  [RW] 

Public Class methods

Creates a Thumbnail object set to work on the file given. It will attempt to transform the image into one defined by target_geometry which is a "WxH"-style string. format will be inferred from the file unless specified. Thumbnail creation will raise no errors unless whiny is true (which it is, by default. If convert_options is set, the options will be appended to the convert command upon image conversion

Options include:

  +geometry+ - the desired width and height of the thumbnail (required)
  +file_geometry_parser+ - an object with a method named +from_file+ that takes an image file and produces its geometry and a +transformation_to+. Defaults to Paperclip::Geometry
  +string_geometry_parser+ - an object with a method named +parse+ that takes a string and produces an object with +width+, +height+, and +to_s+ accessors. Defaults to Paperclip::Geometry
  +source_file_options+ - flags passed to the +convert+ command that influence how the source file is read
  +convert_options+ - flags passed to the +convert+ command that influence how the image is processed
  +whiny+ - whether to raise an error when processing fails. Defaults to true
  +format+ - the desired filename extension
  +animated+ - whether to merge all the layers in the image. Defaults to true

Public Instance methods

Returns true if the image is meant to make use of additional convert options.

Returns true if the target_geometry is meant to crop.

Performs the conversion of the file into a thumbnail. Returns the Tempfile that contains the new image.

Returns the command ImageMagick‘s convert needs to transform the image into the thumbnail.

Protected Instance methods

Return true if the format is animated

[Validate]