Module: Middleman::Presentation::Helpers::ImageGallery

Defined in:
lib/middleman-presentation/helpers/image_gallery.rb

Overview

Images helpers

Instance Method Summary collapse

Instance Method Details

#image(image) ⇒ Object

Create entry for single image



20
21
22
# File 'lib/middleman-presentation/helpers/image_gallery.rb', line 20

def image(image)
  image_gallery Array(image), image_gallery_id: SecureRandom.hex
end

Create image gallery



9
10
11
12
13
14
15
16
17
# File 'lib/middleman-presentation/helpers/image_gallery.rb', line 9

def image_gallery(images, image_gallery_id:)
  template = File.read(File.expand_path('../../../../templates/image_gallery.erb', __FILE__)).chomp

  images.each_with_object([]) do |(image, title), memo|
    engine = Erubis::Eruby.new(template)

    memo << engine.result(image_path: image, image_gallery_id: image_gallery_id, title: title)
  end.join("\n")
end