miniatura 0.3.0 → 0.3.2
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.
- checksums.yaml +4 -4
- data/lib/miniatura/options.rb +2 -2
- data/lib/miniatura/version.rb +1 -1
- data/lib/miniatura.rb +29 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40d72d74dcd7b0870102ee6cfb7b3f08fc9f82de
|
4
|
+
data.tar.gz: 1e33f972f292d3d41f7eb7a7dbae5130c8d23263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24d03e9c0c48bf9bed005146dec06a64c1bba75ad3defcdcbed2667d96ddf7c043c8e5a5d1e4873f26cfff717e7646a5f3556723c9f68f82174ae26bf476abb9
|
7
|
+
data.tar.gz: 30a291027a77130e2d1893b5e16f458ab2b38f95623ae8fb3411f2cdf8dd872a813cc76a4d0e08312bdfe092831b0b89335a60265280434ac6af85ae5d2612bd
|
data/lib/miniatura/options.rb
CHANGED
@@ -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
|
35
|
+
when 180 then %Q(-vf hflip )
|
36
36
|
when 270 then %Q(-vf transpose=2)
|
37
37
|
else
|
38
38
|
""
|
data/lib/miniatura/version.rb
CHANGED
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
|
-
|
15
|
-
|
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.
|
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-
|
11
|
+
date: 2016-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|