app/models/cropper/upload.rb
# *geometry*, given a style name, returns the dimensions of the file if that style were applied. For 
# speed we calculate this rather than reading the file, which might be in S3 or some other distant place. 
# 
# The logic is in [lib/paperclip/geometry_tranformation.rb](/lib/paperclip/geometry_tranformation.html), 
# which is a ruby library that mimics the action of imagemagick's convert command.
#
geometry*, given a style name, returns the dimensions of the file if that style were applied. For
speed we calculate this rather than reading the file, which might be in S3 or some other distant place.


geometry * given a style name returns the dimensions of the file if that style were applied . For speed we calculate this rather than reading the file which might be in S3 or some other distant place .
def geometry(style_name='original')
      @geometry ||= {}
      begin
        @geometry[style_name] ||= if style_name.to_s == 'original'
          original_geometry
        else
          style = self.file.styles[style_name.to_sym]
          original_geometry.transformed_by(style.geometry)
        end
      rescue Paperclip::TransformationError => e
        original_geometry
      end
    end
def geometry ( style_name = 'original' ) @geometry ||= { } begin @geometry [ style_name ] ||= if style_name . to_s == 'original' original_geometry else style = self . file . styles [ style_name . to_sym ] original_geometry . transformed_by ( style . geometry ) end rescue Paperclip :: TransformationError => e original_geometry end end
geometry*, given a style name, returns the dimensions of the file if that style were applied.
geometry * given a style name returns the dimensions of the file if that style were applied .
# These calculations are all memoised. # If no style name is given, or it is 'original', we return the original discovered dimensions. # Otherwise, we apply a mock transformation to see what dimensions would result. # In case of explosion, we always return the original dimensions so that action can continue.
style_name