paperclip-ffmpeg 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/paperclip-ffmpeg.rb +6 -2
- data/paperclip-ffmpeg.gemspec +1 -1
- metadata +1 -1
data/lib/paperclip-ffmpeg.rb
CHANGED
@@ -80,8 +80,12 @@ module Paperclip
|
|
80
80
|
width = target_width.to_i
|
81
81
|
height = (width.to_f / (@meta[:aspect].to_f)).to_i
|
82
82
|
# We should add half the delta as a padding offset Y
|
83
|
-
pad_y = (target_height.to_f - height.to_f)
|
84
|
-
|
83
|
+
pad_y = (target_height.to_f - height.to_f) / 2
|
84
|
+
if pad_y > 0
|
85
|
+
@convert_options[:vf] = "scale=#{width}:-1,pad=#{width.to_i}:#{target_height.to_i}:0:#{pad_y}:black"
|
86
|
+
else
|
87
|
+
@convert_options[:vf] = "scale=#{width}:-1,crop=#{width.to_i}:#{height.to_i}"
|
88
|
+
end
|
85
89
|
else
|
86
90
|
# Keep aspect ratio
|
87
91
|
width = target_width.to_i
|
data/paperclip-ffmpeg.gemspec
CHANGED