Module: Refinery::Images::Dragonfly
- Defined in:
- lib/refinery/images/dragonfly.rb
Class Method Summary collapse
-
.attach!(app) ⇒ Object
Injects Dragonfly::Middleware for Refinery::Images into the stack.
- .configure! ⇒ Object
- .setup! ⇒ Object
Class Method Details
.attach!(app) ⇒ Object
Injects Dragonfly::Middleware for Refinery::Images into the stack
46 47 48 49 50 51 52 |
# File 'lib/refinery/images/dragonfly.rb', line 46 def attach!(app) if ::Rails.application.config.action_controller.perform_caching app.config.middleware.insert_after 'Rack::Cache', 'Dragonfly::Middleware', :refinery_images else app.config.middleware.use 'Dragonfly::Middleware', :refinery_images end end |
.configure! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/refinery/images/dragonfly.rb', line 17 def configure! app_images = ::Dragonfly[:refinery_images] app_images.configure_with(:imagemagick) app_images.configure_with(:rails) do |c| c.datastore.root_path = Refinery::Images.datastore_root_path c.url_format = Refinery::Images.dragonfly_url_format c.url_host = Refinery::Images.dragonfly_url_host c.secret = Refinery::Images.dragonfly_secret c.trust_file_extensions = Refinery::Images.trust_file_extensions end if ::Refinery::Images.s3_backend app_images.datastore = ::Dragonfly::DataStorage::S3DataStore.new app_images.datastore.configure do |s3| s3.bucket_name = Refinery::Images.s3_bucket_name s3.access_key_id = Refinery::Images.s3_access_key_id s3.secret_access_key = Refinery::Images.s3_secret_access_key # S3 Region otherwise defaults to 'us-east-1' s3.region = Refinery::Images.s3_region if Refinery::Images.s3_region end end if Images.custom_backend? app_images.datastore = Images.custom_backend_class.new(Images.custom_backend_opts) end end |
.setup! ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/refinery/images/dragonfly.rb', line 8 def setup! app_images = ::Dragonfly[:refinery_images] app_images.define_macro(::Refinery::Image, :image_accessor) app_images.analyser.register(::Dragonfly::ImageMagick::Analyser) app_images.analyser.register(::Dragonfly::Analysis::FileCommandAnalyser) end |