paperclip - Rails video uploading -
i've searched around different uploading options rails , video , paperclip seems pretty good, there others people recommend, should have tutorials , docs because can't find great paperclip docs involving uploading video content.
we got paperclip working video while back
systems
you'll have same ambiguity whether use carrierwave or paperclip (rails' 2 main "attachment" handlers)
any upload system handles transfer of file data between pc, rails app & db. each of them (from understanding). e.g paperclip creates activerecord
object file, saves data server's public
dir & creates record in db
code
the question of video 1 of using right processor, rather right uploader:
#app/models/attachment.rb has_attached_file :attachment, styles: lambda { |a| a.instance.is_image? ? {:small => "x200>", :medium => "x300>", :large => "x400>"} : {:thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10}, :medium => { :geometry => "300x300#", :format => 'jpg', :time => 10}}}, processors: lambda { |a| a.is_video? ? [ :ffmpeg ] : [ :thumbnail ] }
extra
you'll need use video processor such ffmpeg paperclip:
#gemfile gem "paperclip-ffmpeg", "~> 1.0.1"
you may have install ffmpeg on system processor work locally (heroku has ffmpeg). allow use video_tag
helper:
<%= video_tag(@model.attachment.url) %>
there's tutorial using ffmpeg paperclip here , another tutorial here
Comments
Post a Comment