Sha256: aaf5b00b68e700166d53f6fa0a4813ad91805cb8421750c673b6a27c658065fd
Contents?: true
Size: 866 Bytes
Versions: 3
Compression:
Stored size: 866 Bytes
Contents
module FlyAdmin module Screenshotable extend ::ActiveSupport::Concern module ClassMethods end # needed in categories/_video_desc.html.haml def picture_url "/uploads/video/picture/#{self.id}/screenshot.jpg" end def create_thumbnail movie = FFMPEG::Movie.new(self.full_source_path) screenshot_path = "public/uploads/video/picture/#{self.id}/screenshot.jpg" dir = create_dir screenshot_path seek_time = self.thumb_time.present? ? self.thumb_time : (movie.duration / 2).to_s system("ffmpeg -ss #{seek_time} -y -i #{self.full_source_path.shellescape} -vframes 1 -f image2 #{screenshot_path}") self.thumb_time = seek_time self.picture = screenshot_path end def remove_picture FileUtils.rm_rf(Rails.root.to_s + "/public/uploads/video/picture/#{self.id}/") end end end
Version data entries
3 entries across 3 versions & 1 rubygems