module PhantomHelpers::ViewHelpers::ImageHelper

Public Instance Methods

boolean_image(field) click to toggle source
# File lib/phantom_helpers/view_helpers/image_helper.rb, line 5
def boolean_image(field)
  if field
    image_tag('tick.png')
  else
    image_tag('cross.png')
  end
end
resize_image(image_url, options = {}) click to toggle source
# File lib/phantom_helpers/view_helpers/image_helper.rb, line 13
def resize_image(image_url, options = {})
  raise 'No size given use :size or :width & :height' unless options[:size] || (options[:height] && options[:width])
  height = options[:height] || options[:size]
  width  = options[:width]  || options[:size]
  image_tag(image_url, style: "height:#{height}px;width:#{width}px") unless image_url.blank?
end