简体   繁体   中英

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. class 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?

Debian/Ubuntu

sudo apt-get install imagemagick

MacOSX

brew install imagemagick

To show your video, you can use:

<%= video_tag pin.video.url(:medium), :size => "320x240", :controls => true %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM