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

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

Overview

Images helpers

Class Method Summary collapse

Class Method Details

Create image gallery

Parameters:

  • images (Array)

    An array of image paths, e.g. ‘img/image.png`

  • id (String)

    A unique id for your image gallery - unique within your presentation



14
15
16
17
18
19
20
21
22
# File 'lib/middleman-presentation-helpers/helpers/image_gallery.rb', line 14

def image_gallery(images, 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: id, title: title)
  end.join("\n")
end