Class: RailsImager::ImagesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/rails_imager/images_controller.rb

Constant Summary collapse

PARAMS_ARGS =
[:width, :height, :smartsize, :maxwidth, :maxheight, :rounded_corners, :border, :border_color, :force]
URI_REPLACES =
{
  "%C3%A6" => "æ",
  "%C3%B8" => "ø",
  "%C3%A5" => "å"
}

Instance Method Summary collapse

Instance Method Details

#showObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/rails_imager/images_controller.rb', line 10

def show
  set_and_validate_parameters
  set_path
  @mod_time = File.mtime(@full_path)
  generate_cache_name
  generate_cache if should_generate_cache?
  set_headers

  if not_modified? && !force?
    render nothing: true, status: :not_modified
  else
    send_file @cache_path, type: "image/png", disposition: "inline", filename: "picture.png"
  end
end