Module: Middleman::Thumbnailer::Helpers
- Defined in:
- lib/middleman-thumbnailer/extension.rb
Instance Method Summary collapse
- #thumbnail(image, name, html_options = {}) ⇒ Object
- #thumbnail_specs(image, name) ⇒ Object
- #thumbnail_url(image, name, options = {}) ⇒ Object
Instance Method Details
#thumbnail(image, name, html_options = {}) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/middleman-thumbnailer/extension.rb', line 71 def thumbnail(image, name, = {}) specs_for_data_attribute = thumbnail_specs(image, name).map {|name, spec| "#{name}:#{spec[:name]}"} .merge!({'data-thumbnails' => specs_for_data_attribute.join('|')}) if Thumbnailer.[:include_data_thumbnails] image_tag(thumbnail_url(image, name), ) end |
#thumbnail_specs(image, name) ⇒ Object
57 58 59 60 |
# File 'lib/middleman-thumbnailer/extension.rb', line 57 def thumbnail_specs(image, name) dimensions = Thumbnailer.[:dimensions] ThumbnailGenerator.specs(image, dimensions) end |
#thumbnail_url(image, name, options = {}) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/middleman-thumbnailer/extension.rb', line 62 def thumbnail_url(image, name, = {}) include_images_dir = .delete :include_images_dir url = thumbnail_specs(image, name)[name][:name] url = File.join(images_dir, url) if include_images_dir url end |