Class: Paperclip::Cropper

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

Instance Method Summary collapse

Instance Method Details

#crop_commandObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/paperclip_processors/cropper.rb', line 11

def crop_command
  target = @attachment.instance
  if target.cropping?
    [
      '-crop',
      "#{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}",
      '+repage'
    ]
  end
end

#transformation_commandObject



3
4
5
6
7
8
9
# File 'lib/paperclip_processors/cropper.rb', line 3

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