Sha256: e6660a11af8a3855c8fcd5a515a33412326ab7eccdcd7a7aa126178a2760b646

Contents?: true

Size: 870 Bytes

Versions: 9

Compression:

Stored size: 870 Bytes

Contents

module Middleman
  module AutomaticClowncar
  #actually creates the thumbnail names
  class ThumbnailGenerator
    class << self

      def specs(origin, dimensions, source_dir)
        #puts "origin = #{origin}"
        #puts "source_dir = #{source_dir}"
        origin = Utils.naked_origin(source_dir,origin) # just in case
        width, height = FastImage.size(File.join(source_dir,origin))

        dir = File.dirname(origin)
        filename = File.basename(origin,'.*')
        ext = File.extname(origin)

        dir = File.join(dir,filename)

        ret = {original: {name: origin}}

        dimensions.each do |name, dimension|
          next if dimension > width
          location = File.join(dir,"#{filename}-#{name}#{ext}")
          ret[name] = {name:location , dimensions: dimension}
        end
        ret
      end
    
    
    end
  end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
middleman-automatic-clowncar-4.0.5 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-4.0.4 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-4.0.3 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-4.0.2 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-4.0.1 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-4.0.0 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-0.0.4 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-0.0.3 lib/middleman-automatic-clowncar/thumbnail-generator.rb
middleman-automatic-clowncar-0.0.2 lib/middleman-automatic-clowncar/thumbnail-generator.rb