Sha256: 1d48ab670d2d20380a045a9f528c9329439064d279083655caeb58a4af1a6727

Contents?: true

Size: 734 Bytes

Versions: 59

Compression:

Stored size: 734 Bytes

Contents

Sinatra
=======
You can use {Dragonfly::Job Job}'s `to_response` method like so:

    app = Dragonfly[:images].configure_with(:imagemagick)

    get '/images/:size.:format' do |size, format|
      app.fetch_file('~/some/image.png').thumb(size).encode(format).to_response(env)
    end

`to_response` returns a rack-style response array with status, headers and body.

NOTE: uids from the datastore may have slashes and dots in them so make sure you escape url-escape them when using ':uid' as
a path segment.

or you can mount as a middleware, like in rails:

    Dragonfly[:images].configure_with(:imagemagick) do |c|
      c.url_format = '/media/:job'
    end

    use Dragonfly::Middleware, :images

    get '/' #... do
      # ...

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
classiccms-0.5.16 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.15 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.14 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.13 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.12 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.11 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.10 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.9 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.8 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.7 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.6 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.5 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.2 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.1 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.5.0 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.4.2 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.4.1 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.4.0 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.3.9 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md
classiccms-0.3.8 vendor/bundle/gems/dragonfly-0.9.12/extra_docs/Sinatra.md