miniatura 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e838a42b87bde0a46597ab4952c4eb2146f1d512
4
- data.tar.gz: 1890d14749ccf087d9de942568c7b009483274d3
3
+ metadata.gz: 40d72d74dcd7b0870102ee6cfb7b3f08fc9f82de
4
+ data.tar.gz: 1e33f972f292d3d41f7eb7a7dbae5130c8d23263
5
5
  SHA512:
6
- metadata.gz: c801a6da3abb157d7a0b901e458e1012a404c07fdfad748a6291615bd9ff0459b01cb427e6a464fadcb093a64e0e3af83def00854e0f901f1db307052ee92dbc
7
- data.tar.gz: a5f65e3f252ff4cb01cd9eac592aedefe753e7a1b6d8b4f6275f54ee0c18df1f23aef82c60df72591df1c6c33ebe9da998669e73b59fb8cdc391482a4eb340b6
6
+ metadata.gz: 24d03e9c0c48bf9bed005146dec06a64c1bba75ad3defcdcbed2667d96ddf7c043c8e5a5d1e4873f26cfff717e7646a5f3556723c9f68f82174ae26bf476abb9
7
+ data.tar.gz: 30a291027a77130e2d1893b5e16f458ab2b38f95623ae8fb3411f2cdf8dd872a813cc76a4d0e08312bdfe092831b0b89335a60265280434ac6af85ae5d2612bd
@@ -25,14 +25,14 @@ module Miniatura
25
25
  when 'jpeg' then %Q(-c mjpeg)
26
26
  when 'png' then %Q(-c png)
27
27
  else
28
- " "
28
+ ""
29
29
  end
30
30
  end
31
31
 
32
32
  def rotate value
33
33
  case value
34
34
  when 90 then %Q(-vf transpose=1)
35
- when 180 then %Q(-vf vflip )
35
+ when 180 then %Q(-vf hflip )
36
36
  when 270 then %Q(-vf transpose=2)
37
37
  else
38
38
  ""
@@ -1,3 +1,3 @@
1
1
  module Miniatura
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
data/lib/miniatura.rb CHANGED
@@ -11,27 +11,8 @@ module Miniatura
11
11
  size = options[:size]
12
12
  video = MiniExiftool.new(current_path)
13
13
  orientation = video.rotation
14
- case orientation
15
- when 0
16
- options[:rotate] = 0
17
- when 90
18
- options[:rotate] = 90
19
- when 180
20
- options[:rotate] = 180
21
- when 270
22
- options[:rotate] = 270
23
- end
24
- video_width, video_height = video.imagewidth, video.imageheight
25
- case orientation
26
- when 0,180
27
- image_width = size
28
- ratio = size.to_f/video_width
29
- image_height = video_height * ratio
30
- else
31
- image_width = size
32
- ratio = size.to_f/video_height
33
- image_height = video_width * ratio
34
- end
14
+ options[:rotate] = 0
15
+ image_width, image_height = video_dimension(orientation, video.imagewidth, video.imageheight, size)
35
16
  options[:size] = "#{image_width.to_i}" + "x" + "#{image_height.to_i}"
36
17
  tmp_path = File.join( File.dirname(current_path), "tmpfile.#{options[:file_extension]}")
37
18
  thumbnail = GenerateCommand.new(current_path, tmp_path)
@@ -50,6 +31,33 @@ module Miniatura
50
31
 
51
32
  private
52
33
 
34
+ # def video_rotation orientation
35
+ # case orientation
36
+ # when 0
37
+ # return 0
38
+ # when 90
39
+ # return 0
40
+ # when 180
41
+ # return 180
42
+ # when 270
43
+ # return 0
44
+ # end
45
+ # end
46
+
47
+ def video_dimension orientation, video_width, video_height, size
48
+ case orientation
49
+ when 0,180
50
+ image_width = size
51
+ ratio = size.to_f/video_width
52
+ image_height = video_height * ratio
53
+ else
54
+ image_width = size
55
+ ratio = size.to_f/video_height
56
+ image_height = video_width * ratio
57
+ end
58
+ return image_width, image_height
59
+ end
60
+
53
61
  def handle_exit_code(exit_code, error, logger)
54
62
  if exit_code == 0
55
63
  logger.info "Success!"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miniatura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ssooraj
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler