about summary refs log tree commit diff
path: root/lib/paperclip/gif_transcoder.rb
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-05-17 21:12:45 -0500
committerStarfall <us@starfall.systems>2021-05-17 21:12:45 -0500
commit2c6fcb9cf8fbb09e900fc3625837529155f98f4f (patch)
treeb78e5204ef455b25c06cde33e8a6846ac46fcdbf /lib/paperclip/gif_transcoder.rb
parent2523b046523f92ccf12756dce0204926433d1c7f (diff)
parent567745c1e66593ef46a86dc0bcfe824cefb04f14 (diff)
Merge branch 'glitch'
Diffstat (limited to 'lib/paperclip/gif_transcoder.rb')
-rw-r--r--lib/paperclip/gif_transcoder.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/paperclip/gif_transcoder.rb b/lib/paperclip/gif_transcoder.rb
index 74aa1a0b2..d14465c01 100644
--- a/lib/paperclip/gif_transcoder.rb
+++ b/lib/paperclip/gif_transcoder.rb
@@ -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