Sha256: c2882e68036a07d482693f77a5311ed08c4e8e320df17f2bb2ba0bb29ed235ef

Contents?: true

Size: 779 Bytes

Versions: 4

Compression:

Stored size: 779 Bytes

Contents

module Paperclip  
  class Cropper < Thumbnail  
    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  

    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
  end  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cropimage_riffpad-0.1.1 lib/cropimage_riffpad/paperclip_processors/cropper.rb
cropimage_riffpad-0.1.0 lib/cropimage_riffpad/paperclip_processors/cropper.rb
cropimage_riffpad-0.0.2 lib/cropimage_riffpad/paperclip_processors/cropper.rb
cropimage_riffpad-0.0.1 lib/cropimage_riffpad/paperclip_processors/cropper.rb