Sha256: b70fc606483763b81d1ad0060ad950e0ca878f9c5f74e0903b340dc19946dc86

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

module PictureHelper
  def 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

3 entries across 3 versions & 1 rubygems

Version Path
carrierwave-picture-0.3.3 lib/carrierwave-picture/picture_helper.rb
carrierwave-picture-0.2.1 lib/carrierwave-picture/picture_helper.rb
carrierwave-picture-0.2.0 lib/carrierwave-picture/picture_helper.rb