Module: Pwb::ImagesHelper

Defined in:
app/helpers/pwb/images_helper.rb

Instance Method Summary collapse

Instance Method Details

#bg_image(photo, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/helpers/pwb/images_helper.rb', line 3

def bg_image(photo, options = {})
  image_url = get_opt_image_url photo, options
  # style="background-image:linear-gradient( rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.1) ),url(<%= carousel_item.default_photo %>);"
  if options[:gradient]
    "background-image: linear-gradient(#{options[:gradient]}), url(#{image_url});".html_safe
  else
    "background-image: url(#{image_url});".html_safe
  end
end

#opt_image_tag(photo, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/pwb/images_helper.rb', line 13

def opt_image_tag(photo, options = {})
  unless photo && photo.image.present?
    return nil
  end
  if Rails.application.config.use_cloudinary
    cl_image_tag photo.image, options
  else
    image_tag photo.image.url, options
  end
end

#opt_image_url(photo, options = {}) ⇒ Object



24
25
26
# File 'app/helpers/pwb/images_helper.rb', line 24

def opt_image_url(photo, options = {})
  get_opt_image_url photo, options
end