Class: Paperclip::Cropper

Inherits:
Thumbnail
  • Object
show all
Defined in:
lib/paperclip_processors/cropper.rb

Instance Method Summary collapse

Instance Method Details

#crop_commandObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/paperclip_processors/cropper.rb', line 15

def crop_command
  target = @attachment.instance

  if target.cropping?(@attachment.name)
    w = target.send :"#{@attachment.name}_crop_w"
    h = target.send :"#{@attachment.name}_crop_h"
    x = target.send :"#{@attachment.name}_crop_x"
    y = target.send :"#{@attachment.name}_crop_y"
    ["-crop", "#{w}x#{h}+#{x}+#{y}"]
  end
end

#transformation_commandObject



6
7
8
9
10
11
12
# File 'lib/paperclip_processors/cropper.rb', line 6

def transformation_command
  if crop_command
    crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ')
  else
    super
  end
end