class MountableImageServer::Server

Private Instance Methods

respond_with_image(locator, fid, params) click to toggle source
# File lib/mountable_image_server/server.rb, line 22
def respond_with_image(locator, fid, params)
  if path = locator.path_for(fid)
    image_processor = ImageProcessor.new(path, params)

    image_processor.run do |processed_image_path|
      content_type(Rack::Mime::MIME_TYPES.fetch(processed_image_path.extname.downcase))
      body(processed_image_path.read)
    end
  else
    halt(404)
  end
end