Sha256: c4d02e7964b60f64955b45ddc98b609b82bb3460224a4edbfa30a862cf96a8a2
Contents?: true
Size: 874 Bytes
Versions: 4
Compression:
Stored size: 874 Bytes
Contents
module ImageProcessors class KskCrop < Processor def initialize(file, options = {}, attachment = nil) super @crop = options @format = File.extname(@file.path) @basename = File.basename(@file.path, @format) end def make src = @file dst = Tempfile.new([@basename, @format]) dst.binmode parameters = [] parameters << ":source" parameters << "-crop '#{@crop[2]}x#{@crop[3]}+#{@crop[0]}+#{@crop[1]}'" parameters << ":dest" parameters = parameters.flatten.compact.join(' ').strip.squeeze(' ') path = if @file.options && @file.options[:storage] == :s3 src.url else File.expand_path(src.path) end # success = Paperclip.run('convert', parameters, source: path, dest: File.expand_path(dst.path)) dst end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ksk-0.4.11 | lib/image_processors/ksk_crop.rb |
ksk-0.4.10 | lib/image_processors/ksk_crop.rb |
ksk-0.4.9 | lib/image_processors/ksk_crop.rb |
ksk-0.4.8 | lib/image_processors/ksk_crop.rb |