Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
scrapbook / lib / paperclip_processors / cropped_resize.rb
Size: Mime:
module Paperclip
  class CroppedResize < Thumbnail
    def initialize(file, options = {}, attachment = nil)
      super
      @current_geometry.width = target.crop_metrics[:width]
      @current_geometry.height = target.crop_metrics[:height]
    end

    def target
      @attachment.instance
    end

    def transformation_command
      crop_command = [
         "-crop",
         "#{target.crop_metrics[:width]}x" \
         "#{target.crop_metrics[:height]}+" \
         "#{target.crop_metrics[:x]}+" \
         "#{target.crop_metrics[:y]}",
         "+repage"
      ]

      crop_command + super
    end
  end
end