paperclip
https://github.com/thoughtbot/paperclip
Ruby
Easy file attachment management for ActiveRecord
Paperclip::Thumbnail#initialize
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
Edit
git clone [email protected]:thoughtbot/paperclip.git
cd paperclip
open lib/paperclip/thumbnail.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Paperclip--Thumbnail-initialize-for-pr
# Commit to gitgit add lib/paperclip/thumbnail.rbgit commit -m "better docs for Paperclip::Thumbnail#initialize"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Paperclip--Thumbnail-initialize-for-pr
hub pull-request
# Celebrate!