Module: Allthumbs
- Defined in:
- lib/allthumbs.rb,
lib/allthumbs/version.rb
Constant Summary collapse
- VERSION =
We’re doing this because we might write tests that deal with other versions of bundler and we are unsure how to handle this better.
"0.0.1"
Class Method Summary collapse
-
.generate(files, out, options = {}) ⇒ Object
Generates the montage image for a list of file paths * options :border - surrounding border for each thumbnail in pixels :row - number of thumbnails per row :column - number of thumbnails per column.
Class Method Details
.generate(files, out, options = {}) ⇒ Object
Generates the montage image for a list of file paths
-
options :border - surrounding border for each thumbnail in pixels :row - number of thumbnails per row :column - number of thumbnails per column
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/allthumbs.rb', line 8 def self.generate files, out, = {} row = [:row] column = [:column] border = [:border] raise "Incorrect number of files for specified row and column lengths" if files.size != (row * column) if row and column files.split.map { |file| raise "Attempting to generate with one or more invalid files" unless File.exists? file } begin command = Cocaine::CommandLine.new( "montage", "-geometry :geometry -tile :tile :files", :geometry => "+#{border}+#{border}", :tile => "#{column}x#{row}", :files => (files += " #{out}")).command `#{command.gsub(/'/, '')}` rescue Cocaine::CommandNotFoundError => e raise "Could not run the 'montage' command. Please install ImageMagick." end end |