On 1 Feb 2016, at 20:40, Michael Blum <blumm...@gmail.com> wrote:Hello,
I have a question regarind the dragonfly-gem in Rails. I posted this question on StackOverflow, but nobody seems to know the answer. So I try my luck here...In my Rails 4-Project, I am using Dragonfly to upload images and videos. For image-processing I use
imagemagick
, for videoprocessing I useffmpeg
.Videos are uploaded and stored in the folder
uploads/videos/
. After processing, they are stored inpublic/ffmpeg_videos/
My question is: How can I use the processed-video instead of the uploaded video?
e.g. I use this code in the view, to display a video:
<video src="<%=@video.video.url%>"></video>
This successfully loads the original video from the upload-path. But what do I have to change, to load the video from the ffmpeg-path?
initializers/dragonfly.rb
require 'dragonfly'
# Configure
Dragonfly.app(:images).configure do
plugin :imagemagick
protect_from_dos_attacks false
secret 'd045734b043b4383a246c5c8daf2d3e31217dc8b030f21861e4fd16c4b72d382'
url_format '/media/:job/:name'
datastore :file,
root_path: Rails.root.join('uploads/images/'),
server_root: Rails.root.join('uploads')
end
Dragonfly.app(:videos).configure do
secret 'd045734b043b4383a246c5c8daf2d3e31217dc8b030f21861e4fd16c4b72d382'
url_format "/video/:job/:name"
datastore :file,
root_path: Rails.root.join('uploads/videos/'),
server_root: Rails.root.join('uploads')
end
# Logger
Dragonfly.logger = Rails.logger
# Mount as middleware
Rails.application.middleware.use Dragonfly::Middleware, :images
Rails.application.middleware.use Dragonfly::Middleware, :videos
# Add model functionality
if defined?(ActiveRecord::Base)
ActiveRecord::Base.extend Dragonfly::Model
ActiveRecord::Base.extend Dragonfly::Model::Validations
end
I hope you guys can help me.
Best regards
Michael--
You received this message because you are subscribed to the Google Groups "Dragonfly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dragonfly-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.