paperclip-ffmpeg 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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).abs.to_i / 2
84
- @convert_options[:vf] = "scale=#{width}:-1,pad=#{width.to_i}:#{target_height.to_i}:0:#{pad_y}:black"
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
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "paperclip-ffmpeg"
6
- s.version = '0.6.3'
6
+ s.version = '0.6.4'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Omar Abdel-Wahab"]
9
9
  s.email = ["owahab@gmail.com"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: paperclip-ffmpeg
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.3
5
+ version: 0.6.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Omar Abdel-Wahab