Browse Source

Fix animated GIF generates animated thumbnail (#16216)

closed-social-v3
rinsuki 3 years ago
committed by GitHub
parent
commit
5ed5f62705
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      lib/paperclip/gif_transcoder.rb

+ 6
- 4
lib/paperclip/gif_transcoder.rb View File

@ -108,9 +108,11 @@ module Paperclip
final_file = Paperclip::Transcoder.make(file, options, attachment)
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]
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
@ -118,7 +120,7 @@ module Paperclip
private
def needs_convert?
options[:style] == :original && GifReader.animated?(file.path)
GifReader.animated?(file.path)
end
end
end

Loading…
Cancel
Save