Sha256: 2bcc027afc6c6df117839417c88d5bc283d80bbcb49c6ea22073e27827ecb1ec

Contents?: true

Size: 742 Bytes

Versions: 11

Compression:

Stored size: 742 Bytes

Contents

module Paperclip
  
  class Cropper < Thumbnail
    def transformation_command
      if crop_command
        crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ')
      else
        super
      end
    end
  end
  
  class ThumbCropper < Cropper
    def crop_command
      target = @attachment.instance
      if target.cropping_thumb?
        ["-crop", "#{target.thumb_crop_w}x#{target.thumb_crop_h}+#{target.thumb_crop_x}+#{target.thumb_crop_y}"]
      end
    end
  end
  
  class FullCropper < Cropper
    def crop_command
      target = @attachment.instance
      if target.cropping_full?
        ["-crop", "#{target.full_crop_w}x#{target.full_crop_h}+#{target.full_crop_x}+#{target.full_crop_y}"]
      end
    end
  end
  
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
sweet_portfolio-0.1.0 lib/paperclip_processors/cropper.rb
comfy_gallery-0.1.3 lib/paperclip_processors/cropper.rb
comfy_gallery-0.1.2 lib/paperclip_processors/cropper.rb
comfy_gallery-0.1.1 lib/paperclip_processors/cropper.rb
comfy_gallery-0.1.0 lib/paperclip_processors/cropper.rb
sofa_gallery-0.0.6 lib/paperclip_processors/cropper.rb
sofa_gallery-0.0.5 lib/paperclip_processors/cropper.rb
sofa_gallery-0.0.4 lib/paperclip_processors/cropper.rb
sofa_gallery-0.0.3 lib/paperclip_processors/cropper.rb
sofa_gallery-0.0.2 lib/paperclip_processors/cropper.rb
sofa_gallery-0.0.1 lib/paperclip_processors/cropper.rb