Class: Paperclip::Cropper

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

Instance Method Summary collapse

Instance Method Details

#crop_commandObject



20
21
22
23
24
25
# File 'lib/cropimage_riffpad/paperclip_processors/cropper.rb', line 20

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}"]
  end
end

#transformation_commandObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cropimage_riffpad/paperclip_processors/cropper.rb', line 3

def transformation_command  
  puts "Crop Command command ====> #{crop_command}"
  if crop_command  
    puts "Super .join ===> #{super.join}"
    command = crop_command + super.join(' ').sub(/ -crop \S+/, '').split(" ")
    puts "Transformation command ====> #{command}"
    target = @attachment.instance
    target.crop_w=""
    target.crop_h=""
    target.crop_x=""
    target.crop_y=""
    return command
  else  
    super  
  end   
end