Sha256: 9495741352a803c6fa78d298e71a1d213ba47c3489bb8678bd06b82c1ab7f791

Contents?: true

Size: 1.27 KB

Versions: 68

Compression:

Stored size: 1.27 KB

Contents

Rack
====
For more info about using Rack applications, see the docs at {http://rack.rubyforge.org/}

Basic usage involves storing data (e.g. images),
then serving it in some form.

A basic rackup file `config.ru`:

    require 'rubygems'
    require 'dragonfly'

    Dragonfly[:my_app_name].configure do |c|
      # ... configuration here
    end

    run Dragonfly:App[:my_app_name]

See {file:Configuration} for more details.

The basic flow is instantiate an app -> configure it -> run it.

Example: Using to serve resized images
--------------------------------------

`config.ru`:

    require 'rubygems'
    require 'dragonfly'

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

    run app

This enables the app to use all the ImageMagick goodies provided by Dragonfly (see {file:Configuration}).
By default the {Dragonfly::DataStorage::FileDataStore file data store} is used.

In the console:

    app = Dragonfly[:images]

    # Store
    uid = app.store(File.new('path/to/image.png'))      # ===> unique uid

    # Get the url for a thumbnail
    url = app.fetch(uid).thumb('400x300').url           # ===> "/media/BAhbBlsHOgZmIg9hc..."

Now when we visit the url `/media/BAhbBlsHOgZmIg9hc...` in the browser, we get a resized image!

Mounting in Rack
----------------
See {file:URLs}

Version data entries

68 entries across 68 versions & 4 rubygems

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