Class: SimpleDragonflyPreview::ImageController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/simple_dragonfly_preview/image_controller.rb

Instance Method Summary collapse

Instance Method Details

#iframeObject



16
17
# File 'app/controllers/simple_dragonfly_preview/image_controller.rb', line 16

def iframe
end

#uploadObject



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

def upload
  if params[:image].present?
    app = Dragonfly.app
    uid = app.store(params[:image].tempfile)
    filename = params[:image].original_filename
    @image = app.fetch(uid)
    @retained_image = Dragonfly::Serializer.json_b64_encode(uid: uid, name: filename) if @image 
    @resize = params[:resize]
  end
  render :iframe
end