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