Class: Filemagic::ImageController

Inherits:
ApplicationController show all
Defined in:
app/controllers/filemagic/image_controller.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



15
16
17
18
19
# File 'app/controllers/filemagic/image_controller.rb', line 15

def delete
  return_json = { files: [{"picture1.jpg" => true}] }

  render json: return_json, content_type: request.format
end

#uploadObject



3
4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/filemagic/image_controller.rb', line 3

def upload
  file = params["files"][0]

  refile_file = Refile.store.upload(file)

  url = Refile.file_url(Refile.store.get(refile_file.id), :limit, 720, 1280, filename: file.original_filename.downcase)

  return_json = { files: [{ url: url }] }

  render json: return_json, content_type: request.format, status: 200
end