Sha256: b1ae88ac3720f938b23f11c2c5e02e40ad7e871c543afb19d8a51b39198b49c3

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

module PictureHelper
  def self.picture_tag(path, options = {})

    content_tag(:picture, options) do
      concat content_tag  :source,
                          nil,
                          srcset: "#{path}.webp",
                          type: "image/webp",
                          style: "height: inherit; width: inherit" if File.exist?(Rails.root.join("public/#{path}.webp"))
      concat content_tag  :source,
                          nil,
                          srcset: "#{path}.jp2",
                          type: "image/jp2",
                          style: "height: inherit; width: inherit" if File.exist?(Rails.root.join("public/#{path}.jp2"))
      concat image_tag path, style: "height: inherit; width: inherit"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carrierwave-picture-0.2.2 lib/carrierwave-picture/picture_helper.rb