Sha256: 23ff155ccc5f99f63f0798288d103847aa30e96d84afde406dae9f9c6ca219cd
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'dragonfly' require 'dragonfly/model/validations' module Aerogel::Media # Configures module Aerogel::Media # 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 end # module Aerogel::Media
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aerogel-media-1.4.0 | lib/aerogel/media/core.rb |