Module: DynamicImage::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/dynamic_image/controller.rb
Overview
DynamicImage Controller
Generating images is rather expensive, so all requests must be signed with a HMAC digest in order to avoid denial of service attacks. The methods in DynamicImage::Helper
handles this transparently. As a bonus, this also prevents unauthorized URL enumeration.
Instance Method Summary collapse
- #download ⇒ Object
-
#original ⇒ Object
Renders the original image data, without any processing.
-
#requested_size ⇒ Object
Returns the requested size as a vector.
-
#show ⇒ Object
Renders the image.
-
#uncropped ⇒ Object
Same as
show
, but renders the image without any pre-cropping applied.
Instance Method Details
#download ⇒ Object
35 36 37 |
# File 'lib/dynamic_image/controller.rb', line 35 def download render_raw_image(disposition: "attachment") end |
#original ⇒ Object
Renders the original image data, without any processing.
31 32 33 |
# File 'lib/dynamic_image/controller.rb', line 31 def original render_raw_image end |
#requested_size ⇒ Object
Returns the requested size as a vector.
40 41 42 |
# File 'lib/dynamic_image/controller.rb', line 40 def requested_size Vector2d.parse(params[:size]) end |
#show ⇒ Object
Renders the image.
21 22 23 |
# File 'lib/dynamic_image/controller.rb', line 21 def show render_image(format: requested_format) end |
#uncropped ⇒ Object
Same as show
, but renders the image without any pre-cropping applied.
26 27 28 |
# File 'lib/dynamic_image/controller.rb', line 26 def uncropped render_image(format: requested_format, uncropped: true) end |