mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 00:30:57 +01:00
20 lines
633 B
Ruby
20 lines
633 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Paperclip
|
|
# This transcoder is only to be used for the MediaAttachment model
|
|
# to convert animated GIFs and PNGs to videos
|
|
|
|
class GifvTranscoder < Paperclip::Processor
|
|
def make
|
|
final_file = Paperclip::Transcoder.make(file, options, attachment)
|
|
|
|
if options[:style] == :original
|
|
attachment.instance.file_file_name = "#{File.basename(attachment.instance.file_file_name, '.*')}.mp4"
|
|
attachment.instance.file_content_type = 'video/mp4'
|
|
attachment.instance.type = MediaAttachment.types[:gifv]
|
|
end
|
|
|
|
final_file
|
|
end
|
|
end
|
|
end
|