[英]Paperclip with rails
I'm using the papclip-ffmpeg gem to allow users to upload videos, i installed the gem and ran the quick start code in my user model. 我正在使用papclip-ffmpeg gem允许用户上传视频,我安装了gem并在用户模型中运行了快速入门代码。 class User < ActiveRecord::Base
类User <ActiveRecord :: Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
def
has_many :pins
validates :name, presence: true
has_attached_file :video, :styles => {
:medium => { :geometry => "640x480", :format => 'flv' },
:thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 }
}, :processors => [:ffmpeg]
end
but this renders the error in the upload page to 但这会将上传页面中的错误呈现为
Image There was an error processing the thumbnail for ob2-xvid-d0h-sample20140204-698-19dg2ms
Any ideas would be great thanks. 任何想法都将非常感谢。
The problem you have is when generating the thumbnail, do you have ImageMagick installed in your system? 您遇到的问题是生成缩略图时,系统中是否安装了ImageMagick?
Debian/Ubuntu 于Debian / Ubuntu
sudo apt-get install imagemagick
MacOSX MacOSX的
brew install imagemagick
To show your video, you can use: 要显示视频,您可以使用:
<%= video_tag pin.video.url(:medium), :size => "320x240", :controls => true %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.