paperclip

https://github.com/thoughtbot/paperclip

Ruby

Easy file attachment management for ActiveRecord

Paperclip::Geometry#transformation_to

Returns the scaling and cropping geometries (in string-based ImageMagick format)
neccessary to transform this Geometry into the Geometry given. If crop is true,
then it is assumed the destination Geometry will be the exact final resolution.
In this case, the source Geometry is scaled so that an image containing the
destination Geometry would be completely filled by the source image, and any
overhanging image would be cropped. Useful for square thumbnail images. The cropping
is weighted at the center of the Geometry.

Source | Google | Stack overflow

Edit

git clone [email protected]:thoughtbot/paperclip.git

cd paperclip

open lib/paperclip/geometry.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Paperclip--Geometry-transformation_to-for-pr


# Commit to git

git add lib/paperclip/geometry.rbgit commit -m "better docs for Paperclip::Geometry#transformation_to"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Paperclip--Geometry-transformation_to-for-pr

hub pull-request


# Celebrate!