Sha256: fda552905974c8dd9fdc4a6b4a09c20db8573735240dedb1df359be1e728efef

Contents?: true

Size: 327 Bytes

Versions: 1

Compression:

Stored size: 327 Bytes

Contents

module AmpImageTagHelper
  def amp_image_tag(source, opts = {})
    has_dimensions = !opts[:width].nil? && !opts[:height].nil?
    opts[:width], opts[:height] = FastImage.size(source) unless has_dimensions
    image_tag(source, opts).
      gsub(/^<img/, '<amp-img').
      gsub(/>$/, '></amp-img>').
      html_safe
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amp_helper-0.1.0 lib/amp_helper/amp_image_tag_helper.rb