Module: Aerogel::Media
- Defined in:
- lib/aerogel/media/core.rb,
lib/aerogel/media/version.rb,
lib/aerogel/media/uploaded_file.rb
Defined Under Namespace
Classes: UploadedFile
Constant Summary collapse
- VERSION =
"1.4.0"
Class Method Summary collapse
-
.registered(app) ⇒ Object
Configures module Aerogel::Media.
Class Method Details
.registered(app) ⇒ Object
Configures module Aerogel::Media
8 9 10 11 12 13 14 15 16 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 43 |
# File 'lib/aerogel/media/core.rb', line 8 def self.registered(app) Dragonfly.app(:image).configure do plugin :imagemagick url_format '/media/images/:job/:basename.:ext' datastore :file, root_path: "media" # Returns human readable description of an attachment # define :description do file_name = name.present? ? name : '' "#{file_name} @ #{width}x#{height}, #{Aerogel::I18n.number_to_human_size size}" end end Dragonfly.app(:file).configure do url_format '/media/files/:job/:basename.:ext' datastore :file, root_path: "media" # Force any file to download response_header 'Content-Disposition' do |job, request, headers| "attachment; "+headers['Content-Disposition'] end # Returns human readable description of an attachment # define :description do file_name = name.present? ? name : '' "#{file_name} @ #{Aerogel::I18n.number_to_human_size size}" end end app.use Dragonfly::Middleware, :image app.use Dragonfly::Middleware, :file end |