Class: Alchemy::PicturesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/alchemy/pictures_controller.rb

Constant Summary collapse

ALLOWED_IMAGE_TYPES =
%w(png jpeg gif svg)

Instance Method Summary collapse

Methods included from Modules

included, #module_definition_for, register_module

Methods included from AbilityHelper

#current_ability

Methods included from ConfigurationMethods

#configuration, #multi_language?, #multi_site?, #prefix_locale?

Instance Method Details

#showObject



11
12
13
14
15
16
# File 'app/controllers/alchemy/pictures_controller.rb', line 11

def show
  @size = params[:size]
  expires_in 1.month, public: !@picture.restricted?

  respond_to { |format| send_image(processed_image, format) }
end

#thumbnailObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/alchemy/pictures_controller.rb', line 18

def thumbnail
  case params[:size]
  when 'small'  then @size = '80x60'
  when 'medium' then @size = '160x120'
  when 'large'  then @size = '240x180'
  when nil      then @size = '111x93'
  else
    @size = params[:size]
  end

  respond_to { |format| send_image(processed_image, format, flatten: true) }
end

#zoomObject



31
32
33
# File 'app/controllers/alchemy/pictures_controller.rb', line 31

def zoom
  respond_to { |format| send_image(@picture.image_file, format) }
end