carrierwave-qiniu 1.2.1 → 1.2.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/.env.sample +4 -0
- data/.gitignore +1 -0
- data/.rspec_status +21 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +80 -81
- data/LICENSE.txt +21 -0
- data/README.md +44 -17
- data/Rakefile +5 -1
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/carrierwave-qiniu.gemspec +26 -17
- data/lib/carrierwave-qiniu.rb +8 -3
- data/lib/carrierwave/qiniu/configuration.rb +4 -3
- data/lib/carrierwave/qiniu/connection.rb +152 -0
- data/lib/carrierwave/qiniu/railtie.rb +0 -1
- data/lib/carrierwave/qiniu/url.rb +3 -4
- data/lib/{carrierwave-qiniu → carrierwave/qiniu}/version.rb +1 -2
- data/lib/carrierwave/storage/qiniu.rb +9 -272
- data/lib/carrierwave/storage/qiniu_file.rb +166 -0
- data/lib/carrierwave/tasks/qiniu.rake +1 -1
- metadata +25 -22
- data/LICENSE +0 -22
- data/lib/carrierwave/uploader/base.rb +0 -21
- data/spec/mm.jpg +0 -0
- data/spec/spec_helper.rb +0 -53
- data/spec/upload_spec.rb +0 -274
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cbd13740c5daba706d4ec42e685f737a24d943ef4174e4e1b2cc8655f38bbc8
|
4
|
+
data.tar.gz: 2ed7b2ff0a935b405a37146dc702a8878c8da3ccd908a471976b9d1b46b67261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33bc0e6f25857c631f5e2ac59894495d75a0c0ba4015fbc86f3875e00e179631ca1425336e3ce92a07cfe7a70a3e2f98766a281b0a56f3efd4751e87e9f9bbaf
|
7
|
+
data.tar.gz: b13d6fe48838cd66a2366699290ddd936a5453cf013a5e9de7d6be4e6fb89dfbf5896a0458c71f466aee9212f22391b4504de1018d3513d50871c67401b3f26a
|
data/.env.sample
ADDED
data/.gitignore
CHANGED
data/.rspec_status
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
----------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/carrierwave_qiniu_spec.rb[1:1] | passed | 0.00122 seconds |
|
4
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:1] | passed | 1.09 seconds |
|
5
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:2] | passed | 2.6 seconds |
|
6
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:3] | passed | 1.25 seconds |
|
7
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:4] | passed | 2.5 seconds |
|
8
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:5] | passed | 1.77 seconds |
|
9
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:6:1] | passed | 0.51601 seconds |
|
10
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:6:2] | passed | 0.46774 seconds |
|
11
|
+
./spec/carrierwave_qiniu_spec.rb[1:2:6:3] | passed | 0.45134 seconds |
|
12
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:1:1] | passed | 0.36893 seconds |
|
13
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:1:2] | passed | 0.40568 seconds |
|
14
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:2:1] | passed | 0.38115 seconds |
|
15
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:2:2] | passed | 0.38565 seconds |
|
16
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:2:3] | passed | 0.36964 seconds |
|
17
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:3:1] | passed | 0.41991 seconds |
|
18
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:4:1] | passed | 0.41857 seconds |
|
19
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:4:2] | passed | 0.37235 seconds |
|
20
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:4:3] | passed | 0.38322 seconds |
|
21
|
+
./spec/carrierwave_qiniu_spec.rb[1:3:4:4] | passed | 0.37941 seconds |
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.7.0
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -4,13 +4,15 @@ source "https://gems.ruby-china.com"
|
|
4
4
|
# Specify your gem's dependencies in carrierwave-qiniu.gemspec
|
5
5
|
gemspec
|
6
6
|
|
7
|
+
gem "rake", "~> 12.0"
|
8
|
+
gem "rspec", "~> 3.0"
|
9
|
+
|
7
10
|
group :test do
|
8
11
|
gem "rails", "~> 6.0.0"
|
9
12
|
gem "sqlite3"
|
10
13
|
gem "carrierwave", ">= 1"
|
11
14
|
gem "mini_magick"
|
12
15
|
gem "qiniu", "~> 6.9"
|
13
|
-
gem "rspec"
|
14
16
|
gem "mocha"
|
15
17
|
gem "dotenv"
|
16
18
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
carrierwave-qiniu (1.2.
|
4
|
+
carrierwave-qiniu (1.2.2)
|
5
5
|
carrierwave (>= 1)
|
6
6
|
qiniu (~> 6.9, >= 6.9.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://gems.ruby-china.com/
|
10
10
|
specs:
|
11
|
-
actioncable (6.0.
|
12
|
-
actionpack (= 6.0.
|
11
|
+
actioncable (6.0.2.1)
|
12
|
+
actionpack (= 6.0.2.1)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.0.
|
16
|
-
actionpack (= 6.0.
|
17
|
-
activejob (= 6.0.
|
18
|
-
activerecord (= 6.0.
|
19
|
-
activestorage (= 6.0.
|
20
|
-
activesupport (= 6.0.
|
15
|
+
actionmailbox (6.0.2.1)
|
16
|
+
actionpack (= 6.0.2.1)
|
17
|
+
activejob (= 6.0.2.1)
|
18
|
+
activerecord (= 6.0.2.1)
|
19
|
+
activestorage (= 6.0.2.1)
|
20
|
+
activesupport (= 6.0.2.1)
|
21
21
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.0.
|
23
|
-
actionpack (= 6.0.
|
24
|
-
actionview (= 6.0.
|
25
|
-
activejob (= 6.0.
|
22
|
+
actionmailer (6.0.2.1)
|
23
|
+
actionpack (= 6.0.2.1)
|
24
|
+
actionview (= 6.0.2.1)
|
25
|
+
activejob (= 6.0.2.1)
|
26
26
|
mail (~> 2.5, >= 2.5.4)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (6.0.
|
29
|
-
actionview (= 6.0.
|
30
|
-
activesupport (= 6.0.
|
31
|
-
rack (~> 2.0)
|
28
|
+
actionpack (6.0.2.1)
|
29
|
+
actionview (= 6.0.2.1)
|
30
|
+
activesupport (= 6.0.2.1)
|
31
|
+
rack (~> 2.0, >= 2.0.8)
|
32
32
|
rack-test (>= 0.6.3)
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
34
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (6.0.
|
36
|
-
actionpack (= 6.0.
|
37
|
-
activerecord (= 6.0.
|
38
|
-
activestorage (= 6.0.
|
39
|
-
activesupport (= 6.0.
|
35
|
+
actiontext (6.0.2.1)
|
36
|
+
actionpack (= 6.0.2.1)
|
37
|
+
activerecord (= 6.0.2.1)
|
38
|
+
activestorage (= 6.0.2.1)
|
39
|
+
activesupport (= 6.0.2.1)
|
40
40
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (6.0.
|
42
|
-
activesupport (= 6.0.
|
41
|
+
actionview (6.0.2.1)
|
42
|
+
activesupport (= 6.0.2.1)
|
43
43
|
builder (~> 3.1)
|
44
44
|
erubi (~> 1.4)
|
45
45
|
rails-dom-testing (~> 2.0)
|
46
46
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (6.0.
|
48
|
-
activesupport (= 6.0.
|
47
|
+
activejob (6.0.2.1)
|
48
|
+
activesupport (= 6.0.2.1)
|
49
49
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.0.
|
51
|
-
activesupport (= 6.0.
|
52
|
-
activerecord (6.0.
|
53
|
-
activemodel (= 6.0.
|
54
|
-
activesupport (= 6.0.
|
55
|
-
activestorage (6.0.
|
56
|
-
actionpack (= 6.0.
|
57
|
-
activejob (= 6.0.
|
58
|
-
activerecord (= 6.0.
|
50
|
+
activemodel (6.0.2.1)
|
51
|
+
activesupport (= 6.0.2.1)
|
52
|
+
activerecord (6.0.2.1)
|
53
|
+
activemodel (= 6.0.2.1)
|
54
|
+
activesupport (= 6.0.2.1)
|
55
|
+
activestorage (6.0.2.1)
|
56
|
+
actionpack (= 6.0.2.1)
|
57
|
+
activejob (= 6.0.2.1)
|
58
|
+
activerecord (= 6.0.2.1)
|
59
59
|
marcel (~> 0.3.1)
|
60
|
-
activesupport (6.0.
|
60
|
+
activesupport (6.0.2.1)
|
61
61
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
62
|
i18n (>= 0.7, < 2)
|
63
63
|
minitest (~> 5.1)
|
64
64
|
tzinfo (~> 1.1)
|
65
|
-
zeitwerk (~> 2.
|
65
|
+
zeitwerk (~> 2.2)
|
66
66
|
addressable (2.7.0)
|
67
67
|
public_suffix (>= 2.0.2, < 5.0)
|
68
|
-
builder (3.2.
|
68
|
+
builder (3.2.4)
|
69
69
|
carrierwave (2.0.2)
|
70
70
|
activemodel (>= 5.0.0)
|
71
71
|
activesupport (>= 5.0.0)
|
@@ -74,12 +74,12 @@ GEM
|
|
74
74
|
mimemagic (>= 0.3.0)
|
75
75
|
mini_mime (>= 0.1.3)
|
76
76
|
concurrent-ruby (1.1.5)
|
77
|
-
crass (1.0.
|
77
|
+
crass (1.0.6)
|
78
78
|
diff-lcs (1.3)
|
79
79
|
domain_name (0.5.20190701)
|
80
80
|
unf (>= 0.0.5, < 1.0.0)
|
81
81
|
dotenv (2.7.5)
|
82
|
-
erubi (1.
|
82
|
+
erubi (1.9.0)
|
83
83
|
ffi (1.12.1)
|
84
84
|
globalid (0.4.2)
|
85
85
|
activesupport (>= 4.2.0)
|
@@ -91,59 +91,57 @@ GEM
|
|
91
91
|
image_processing (1.10.3)
|
92
92
|
mini_magick (>= 4.9.5, < 5)
|
93
93
|
ruby-vips (>= 2.0.17, < 3)
|
94
|
-
loofah (2.
|
94
|
+
loofah (2.4.0)
|
95
95
|
crass (~> 1.0.2)
|
96
96
|
nokogiri (>= 1.5.9)
|
97
97
|
mail (2.7.1)
|
98
98
|
mini_mime (>= 0.1.1)
|
99
99
|
marcel (0.3.3)
|
100
100
|
mimemagic (~> 0.3.2)
|
101
|
-
metaclass (0.0.4)
|
102
101
|
method_source (0.9.2)
|
103
102
|
mime-types (3.3.1)
|
104
103
|
mime-types-data (~> 3.2015)
|
105
104
|
mime-types-data (3.2019.1009)
|
106
105
|
mimemagic (0.3.3)
|
107
|
-
mini_magick (4.
|
106
|
+
mini_magick (4.10.1)
|
108
107
|
mini_mime (1.0.2)
|
109
108
|
mini_portile2 (2.4.0)
|
110
109
|
minitest (5.14.0)
|
111
|
-
mocha (1.
|
112
|
-
metaclass (~> 0.0.1)
|
110
|
+
mocha (1.11.2)
|
113
111
|
netrc (0.11.0)
|
114
|
-
nio4r (2.5.
|
115
|
-
nokogiri (1.10.
|
112
|
+
nio4r (2.5.2)
|
113
|
+
nokogiri (1.10.7)
|
116
114
|
mini_portile2 (~> 2.4.0)
|
117
115
|
public_suffix (4.0.3)
|
118
116
|
qiniu (6.9.0)
|
119
117
|
mime-types (~> 3.1)
|
120
118
|
rest-client (~> 2.0)
|
121
|
-
rack (2.
|
119
|
+
rack (2.1.1)
|
122
120
|
rack-test (1.1.0)
|
123
121
|
rack (>= 1.0, < 3)
|
124
|
-
rails (6.0.
|
125
|
-
actioncable (= 6.0.
|
126
|
-
actionmailbox (= 6.0.
|
127
|
-
actionmailer (= 6.0.
|
128
|
-
actionpack (= 6.0.
|
129
|
-
actiontext (= 6.0.
|
130
|
-
actionview (= 6.0.
|
131
|
-
activejob (= 6.0.
|
132
|
-
activemodel (= 6.0.
|
133
|
-
activerecord (= 6.0.
|
134
|
-
activestorage (= 6.0.
|
135
|
-
activesupport (= 6.0.
|
122
|
+
rails (6.0.2.1)
|
123
|
+
actioncable (= 6.0.2.1)
|
124
|
+
actionmailbox (= 6.0.2.1)
|
125
|
+
actionmailer (= 6.0.2.1)
|
126
|
+
actionpack (= 6.0.2.1)
|
127
|
+
actiontext (= 6.0.2.1)
|
128
|
+
actionview (= 6.0.2.1)
|
129
|
+
activejob (= 6.0.2.1)
|
130
|
+
activemodel (= 6.0.2.1)
|
131
|
+
activerecord (= 6.0.2.1)
|
132
|
+
activestorage (= 6.0.2.1)
|
133
|
+
activesupport (= 6.0.2.1)
|
136
134
|
bundler (>= 1.3.0)
|
137
|
-
railties (= 6.0.
|
135
|
+
railties (= 6.0.2.1)
|
138
136
|
sprockets-rails (>= 2.0.0)
|
139
137
|
rails-dom-testing (2.0.3)
|
140
138
|
activesupport (>= 4.2.0)
|
141
139
|
nokogiri (>= 1.6)
|
142
|
-
rails-html-sanitizer (1.
|
143
|
-
loofah (~> 2.
|
144
|
-
railties (6.0.
|
145
|
-
actionpack (= 6.0.
|
146
|
-
activesupport (= 6.0.
|
140
|
+
rails-html-sanitizer (1.3.0)
|
141
|
+
loofah (~> 2.3)
|
142
|
+
railties (6.0.2.1)
|
143
|
+
actionpack (= 6.0.2.1)
|
144
|
+
activesupport (= 6.0.2.1)
|
147
145
|
method_source
|
148
146
|
rake (>= 0.8.7)
|
149
147
|
thor (>= 0.20.3, < 2.0)
|
@@ -153,30 +151,30 @@ GEM
|
|
153
151
|
http-cookie (>= 1.0.2, < 2.0)
|
154
152
|
mime-types (>= 1.16, < 4.0)
|
155
153
|
netrc (~> 0.8)
|
156
|
-
rspec (3.
|
157
|
-
rspec-core (~> 3.
|
158
|
-
rspec-expectations (~> 3.
|
159
|
-
rspec-mocks (~> 3.
|
160
|
-
rspec-core (3.
|
161
|
-
rspec-support (~> 3.
|
162
|
-
rspec-expectations (3.
|
154
|
+
rspec (3.9.0)
|
155
|
+
rspec-core (~> 3.9.0)
|
156
|
+
rspec-expectations (~> 3.9.0)
|
157
|
+
rspec-mocks (~> 3.9.0)
|
158
|
+
rspec-core (3.9.1)
|
159
|
+
rspec-support (~> 3.9.1)
|
160
|
+
rspec-expectations (3.9.0)
|
163
161
|
diff-lcs (>= 1.2.0, < 2.0)
|
164
|
-
rspec-support (~> 3.
|
165
|
-
rspec-mocks (3.
|
162
|
+
rspec-support (~> 3.9.0)
|
163
|
+
rspec-mocks (3.9.1)
|
166
164
|
diff-lcs (>= 1.2.0, < 2.0)
|
167
|
-
rspec-support (~> 3.
|
168
|
-
rspec-support (3.
|
165
|
+
rspec-support (~> 3.9.0)
|
166
|
+
rspec-support (3.9.2)
|
169
167
|
ruby-vips (2.0.17)
|
170
168
|
ffi (~> 1.9)
|
171
|
-
sprockets (
|
169
|
+
sprockets (4.0.0)
|
172
170
|
concurrent-ruby (~> 1.0)
|
173
171
|
rack (> 1, < 3)
|
174
172
|
sprockets-rails (3.2.1)
|
175
173
|
actionpack (>= 4.0)
|
176
174
|
activesupport (>= 4.0)
|
177
175
|
sprockets (>= 3.0.0)
|
178
|
-
sqlite3 (1.4.
|
179
|
-
thor (0.
|
176
|
+
sqlite3 (1.4.2)
|
177
|
+
thor (1.0.1)
|
180
178
|
thread_safe (0.3.6)
|
181
179
|
tzinfo (1.2.6)
|
182
180
|
thread_safe (~> 0.1)
|
@@ -199,7 +197,8 @@ DEPENDENCIES
|
|
199
197
|
mocha
|
200
198
|
qiniu (~> 6.9)
|
201
199
|
rails (~> 6.0.0)
|
202
|
-
|
200
|
+
rake (~> 12.0)
|
201
|
+
rspec (~> 3.0)
|
203
202
|
sqlite3
|
204
203
|
|
205
204
|
BUNDLED WITH
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Marble Wu
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Carrierwave::Qiniu
|
2
2
|
|
3
|
-
[](http://badge.fury.io/rb/carrierwave-qiniu)
|
4
4
|
|
5
5
|
This gem adds storage support for [Qiniu](http://qiniutek.com) to [Carrierwave](https://github.com/jnicklas/carrierwave)
|
6
6
|
|
@@ -10,7 +10,7 @@ example: https://github.com/huobazi/carrierwave-qiniu-example
|
|
10
10
|
|
11
11
|
Add the following to your application's Gemfile:
|
12
12
|
|
13
|
-
gem 'carrierwave-qiniu', '~> 1.2.
|
13
|
+
gem 'carrierwave-qiniu', '~> 1.2.2'
|
14
14
|
gem 'carrierwave-i18n' # If you need to use locales other than English
|
15
15
|
|
16
16
|
And then execute:
|
@@ -19,7 +19,7 @@ And then execute:
|
|
19
19
|
|
20
20
|
Or install it yourself as:
|
21
21
|
|
22
|
-
$ gem install carrierwave-qiniu -v 1.2.
|
22
|
+
$ gem install carrierwave-qiniu -v 1.2.2
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
@@ -64,18 +64,42 @@ class AvatarUploader < CarrierWave::Uploader::Base
|
|
64
64
|
self.qiniu_callback_url = "http://<ip1>/callback;http://<ip2>/callback"
|
65
65
|
self.qiniu_callback_body = "key=$(key)&hash=$(etag)&w=$(imageInfo.width)&h=$(imageInfo.height)" # see http://developer.qiniu.com/docs/v6/api/overview/up/response/vars.html#magicvar
|
66
66
|
self.qiniu_persistent_notify_url = "http://<ip>/notify"
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
67
|
+
|
68
|
+
# 使用的队列名称,不设置代表不使用私有队列,使用公有队列
|
69
|
+
# 可以自己创建私有队列 see: https://portal.qiniu.com/dora/mps/new
|
70
|
+
self.qiniu_persistent_pipeline = "marble_persistent"
|
71
|
+
|
72
|
+
# 指定预转数据处理命令,返回由每条命令组成的数组
|
73
|
+
# See
|
74
|
+
# https://developer.qiniu.com/dora/api/1291/persistent-data-processing-pfop#
|
75
|
+
# https://developer.qiniu.com/dora/api/3686/pfop-directions-for-use
|
76
|
+
# https://developer.qiniu.com/kodo/manual/1206/put-policy#persistentOps
|
77
|
+
def qiniu_persistent_ops
|
78
|
+
commands = []
|
79
|
+
|
80
|
+
# 以预转持久化形式,将mp4视频转换为flv格式。
|
81
|
+
# https://developer.qiniu.com/dora/api/1248/audio-and-video-transcoding-avthumb
|
82
|
+
fops1 = "avthumb/flv"
|
83
|
+
saveas_key1 = ::Qiniu::Utils.urlsafe_base64_encode("#{self.qiniu_bucket}:#{store_dir}/#{self.filename}_flv.flv")
|
84
|
+
fops1 = fops1 + '|saveas/' + saveas_key1
|
85
|
+
commands << fops1
|
86
|
+
|
87
|
+
# 以预转持久化形式,将mp4视频转换为avi格式。
|
88
|
+
# https://developer.qiniu.com/dora/api/1248/audio-and-video-transcoding-avthumb
|
89
|
+
fops2 = "avthumb/avi"
|
90
|
+
saveas_key2 = ::Qiniu::Utils.urlsafe_base64_encode("#{self.qiniu_bucket}:#{store_dir}/#{self.filename}_avi.avi")
|
91
|
+
fops2 = fops2 + '|saveas/' + saveas_key2
|
92
|
+
commands << fops2
|
93
|
+
|
94
|
+
# 要进行视频截图操作。
|
95
|
+
# https://developer.qiniu.com/dora/api/1313/video-frame-thumbnails-vframe
|
96
|
+
fops3 = "vframe/jpg/offset/3/w/1280/h/720/rotate/auto"
|
97
|
+
saveas_key3 = ::Qiniu::Utils.urlsafe_base64_encode("#{self.qiniu_bucket}:#{store_dir}/#{self.filename}_screenshot.jpg")
|
98
|
+
fops3 = fops3 + '|saveas/' + saveas_key3
|
99
|
+
commands << fops3
|
100
|
+
|
101
|
+
commands
|
102
|
+
end
|
79
103
|
end
|
80
104
|
```
|
81
105
|
|
@@ -126,7 +150,6 @@ end
|
|
126
150
|
|
127
151
|
class AvatarUploader < CarrierWave::Uploader::Base
|
128
152
|
storage :qiniu
|
129
|
-
|
130
153
|
use_qiniu_styles
|
131
154
|
end
|
132
155
|
|
@@ -160,7 +183,11 @@ $ rake carrierwave:qiniu:sync_styles
|
|
160
183
|
```
|
161
184
|
You can see a example project on: https://github.com/huobazi/carrierwave-qiniu-example
|
162
185
|
|
163
|
-
or see the spec test on https://github.com/huobazi/carrierwave-qiniu/blob/master/spec/
|
186
|
+
or see the spec test on https://github.com/huobazi/carrierwave-qiniu/blob/master/spec/carrierwave-qiniu_spec.rb
|
187
|
+
|
188
|
+
## LICENSE
|
189
|
+
|
190
|
+
See the [LICENSE](https://github.com/huobazi/carrierwave-qiniu/blob/master/LICENSE.txt).
|
164
191
|
|
165
192
|
## Contributing
|
166
193
|
|