Sha256: 024ecc7a37ed6bd4b4077ef1bc2d2881cf302def234a676fc954a56f5f4b7d2f
Contents?: true
Size: 917 Bytes
Versions: 19
Compression:
Stored size: 917 Bytes
Contents
module PopulateMe class Variation < Struct.new :name, :ext, :job # Simple class to deal with variations of an attachment # Mainly variation of images using ImageMagick # but it could be anything else like creating the pdf version # of a text file def initialize name, ext, job_as_proc=nil, &job_as_block super name, ext, job_as_proc||job_as_block end class << self def new_image_magick_job name, ext, convert_string, options={} o = { strip: true, progressive: true, }.merge(options) defaults = "" defaults << "-strip " if o[:strip] defaults << "-interlace Plane " if o[:progressive] and [:jpg,:jpeg].include?(ext.to_sym) job = lambda{ |src,dst| Kernel.system "convert \"#{src}\" #{defaults}#{convert_string} \"#{dst}\"" } self.new name, ext, job end end end end
Version data entries
19 entries across 19 versions & 1 rubygems