app/helpers/site/image_helper.rb
# Goes through some markup looking for images, which it turns into responsive images.
#
# === Parameters
#
# [html] the markup to parse
Goes through some markup looking for images, which it turns into responsive images.
Parameters

[html] the markup to parse
Goes through some markup looking for images which it turns into responsive images . Parameters [ html ] the markup to parse
def render_responsive_images( html )
    html.gsub(/<img(?:\s+(?:data-media-id="(\d+)")|(?:data-align="([a-z]+)")|(?:.*?))+>/) do |mat|
      return "" if $1.nil?
      begin
        media = Media.find( $1 )
        render( partial: 'rendered-image.html', locals: { image: media, alignment: $2.downcase.to_sym })
      rescue
        ""
      end
    end
  end
def render_responsive_images ( html ) html . gsub ( / <img(?: \s +(?:data-media-id="( \d +)")|(?:data-align="([a-z]+)")|(?:.*?))+> / ) do | mat | return "" if $1 . nil? begin media = Media . find ( $1 ) render ( partial : 'rendered-image.html' , locals : { image : media , alignment : $2 . downcase . to_sym } ) rescue "" end end end
Goes through some markup looking for images, which it turns into responsive images.
Goes through some markup looking for images which it turns into responsive images .
# if we have neither a media ID or anything, bail # endeavour to load a media
html