Module: PictureFilesHelper

Included in:
AgentsHelper
Defined in:
app/helpers/picture_files_helper.rb

Instance Method Summary collapse

Instance Method Details

#show_image(picture_file, options = {size: :medium}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/picture_files_helper.rb', line 2

def show_image(picture_file, options = {size: :medium})
  case options[:size]
  when :medium
    if picture_file.picture_width.to_i >= 600
      return image_tag picture_file_path(picture_file, format: :download, size: :medium), alt: "*", width: 600
    end
  when :thumb
    if picture_file.picture_width.to_i >= 100
      return image_tag picture_file_path(picture_file, format: :download, size: :thumb), alt: "*", width: 100
    end
  end
  image_tag picture_file_path(picture_file, format: :download, size: :original), alt: "*", width: picture_file.picture_width, height: picture_file.picture_height
end