ruby-thumbor 1.0.0 → 1.1.0

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.
@@ -0,0 +1,7 @@
1
+ def decrypt_in_thumbor(str)
2
+ command = "python -c 'from thumbor.crypto import Cryptor; cr = Cryptor(\"my-security-keymy\"); print cr.decrypt(\"" << str << "\")'"
3
+ result = Array.new
4
+ IO.popen(command) { |f| result.push(f.gets) }
5
+ result = result.join('').strip
6
+ JSON.parse(result.gsub('"', "@@@").gsub("'", '"').gsub("@@@", '\\"').gsub('True', 'true').gsub('False', 'false').gsub('None', 'null'))
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-thumbor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,32 +9,16 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-18 00:00:00.000000000 Z
12
+ date: 2012-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rdoc
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '3.10'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: '3.10'
30
- - !ruby/object:Gem::Dependency
31
- name: newgem
15
+ name: rspec
32
16
  requirement: !ruby/object:Gem::Requirement
33
17
  none: false
34
18
  requirements:
35
19
  - - ! '>='
36
20
  - !ruby/object:Gem::Version
37
- version: 1.5.3
21
+ version: '0'
38
22
  type: :development
39
23
  prerelease: false
40
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,51 +26,42 @@ dependencies:
42
26
  requirements:
43
27
  - - ! '>='
44
28
  - !ruby/object:Gem::Version
45
- version: 1.5.3
29
+ version: '0'
46
30
  - !ruby/object:Gem::Dependency
47
- name: hoe
31
+ name: simplecov
48
32
  requirement: !ruby/object:Gem::Requirement
49
33
  none: false
50
34
  requirements:
51
- - - ~>
35
+ - - ! '>='
52
36
  - !ruby/object:Gem::Version
53
- version: '3.0'
37
+ version: '0'
54
38
  type: :development
55
39
  prerelease: false
56
40
  version_requirements: !ruby/object:Gem::Requirement
57
41
  none: false
58
42
  requirements:
59
- - - ~>
43
+ - - ! '>='
60
44
  - !ruby/object:Gem::Version
61
- version: '3.0'
45
+ version: '0'
62
46
  description: ruby-thumbor is the client to the thumbor imaging service (http://github.com/globocom/thumbor).
63
47
  email:
64
48
  - heynemann@gmail.com
65
49
  executables: []
66
50
  extensions: []
67
- extra_rdoc_files:
68
- - History.txt
69
- - Manifest.txt
70
- - PostInstall.txt
71
- - README.rdoc
51
+ extra_rdoc_files: []
72
52
  files:
73
- - History.txt
74
- - Manifest.txt
75
- - PostInstall.txt
76
- - README.rdoc
77
- - Rakefile
78
53
  - lib/ruby-thumbor.rb
79
- - script/console
80
- - script/destroy
81
- - script/generate
82
- - spec/ruby-thumbor_spec.rb
83
- - spec/spec.opts
54
+ - lib/thumbor/cascade.rb
55
+ - lib/thumbor/crypto_url.rb
56
+ - lib/thumbor/version.rb
57
+ - README.rdoc
84
58
  - spec/spec_helper.rb
85
- - tasks/rspec.rake
86
- - .gemtest
59
+ - spec/thumbor/cascade_spec.rb
60
+ - spec/thumbor/crypto_url_spec.rb
61
+ - spec/util/thumbor.rb
87
62
  homepage: http://github.com/heynemann/ruby-thumbor
88
63
  licenses: []
89
- post_install_message: PostInstall.txt
64
+ post_install_message:
90
65
  rdoc_options:
91
66
  - --main
92
67
  - README.rdoc
@@ -98,9 +73,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
73
  - - ! '>='
99
74
  - !ruby/object:Gem::Version
100
75
  version: '0'
101
- segments:
102
- - 0
103
- hash: 632787892230243515
104
76
  required_rubygems_version: !ruby/object:Gem::Requirement
105
77
  none: false
106
78
  requirements:
@@ -108,9 +80,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
80
  - !ruby/object:Gem::Version
109
81
  version: '0'
110
82
  requirements: []
111
- rubyforge_project: ruby-thumbor
83
+ rubyforge_project:
112
84
  rubygems_version: 1.8.24
113
85
  signing_key:
114
86
  specification_version: 3
115
87
  summary: ruby-thumbor is the client to the thumbor imaging service (http://github.com/globocom/thumbor).
116
- test_files: []
88
+ test_files:
89
+ - spec/spec_helper.rb
90
+ - spec/thumbor/cascade_spec.rb
91
+ - spec/thumbor/crypto_url_spec.rb
92
+ - spec/util/thumbor.rb
data/.gemtest DELETED
File without changes
data/History.txt DELETED
@@ -1,19 +0,0 @@
1
- === 0.7.0 2012-06-14
2
-
3
- * Bugfixes:
4
- * Ignore filters option to #generate if the array is empty
5
-
6
- === 0.6.0 2012-03-14
7
-
8
- * 1 major enhancement:
9
- * Support for filters in the urls
10
-
11
- === 0.5.0 2011-04-19
12
-
13
- * 1 major enhancement:
14
- * Fit-in support in the url
15
-
16
- === 0.0.1 2011-04-02
17
-
18
- * 1 major enhancement:
19
- * Initial release
data/Manifest.txt DELETED
@@ -1,13 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- PostInstall.txt
4
- README.rdoc
5
- Rakefile
6
- lib/ruby-thumbor.rb
7
- script/console
8
- script/destroy
9
- script/generate
10
- spec/ruby-thumbor_spec.rb
11
- spec/spec.opts
12
- spec/spec_helper.rb
13
- tasks/rspec.rake
data/PostInstall.txt DELETED
@@ -1,3 +0,0 @@
1
-
2
- For more information on ruby-thumbor, see https://rubygems.org/gems/ruby-thumbor.
3
-
data/Rakefile DELETED
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/ruby-thumbor'
6
-
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'ruby-thumbor' do
14
- self.developer 'Bernardo Heynemann', 'heynemann@gmail.com'
15
- self.post_install_message = 'PostInstall.txt'
16
- self.rubyforge_name = 'ruby-thumbor'
17
- end
18
-
19
- require 'newgem/tasks'
20
- Dir['tasks/**/*.rake'].each { |t| import t }
21
-
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/ruby-thumbor.rb'}"
9
- puts "Loading ruby-thumbor gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
@@ -1,436 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
- require 'json'
3
-
4
- image_url = 'my.domain.com/some/image/url.jpg'
5
- image_md5 = 'f33af67e41168e80fcc5b00f8bd8061a'
6
- key = 'my-security-key'
7
-
8
- def decrypt_in_thumbor(str)
9
- command = "python -c 'from thumbor.crypto import Cryptor; cr = Cryptor(\"my-security-keymy\"); print cr.decrypt(\"" << str << "\")'"
10
- result = Array.new
11
- IO.popen(command) { |f| result.push(f.gets) }
12
- result = result.join('').strip
13
- JSON.parse(result.gsub('"', "@@@").gsub("'", '"').gsub("@@@", '\\"').gsub('True', 'true').gsub('False', 'false'))
14
- end
15
-
16
- describe Thumbor::CryptoURL, "#new" do
17
-
18
- it "should create a new instance passing key and keep it" do
19
- crypto = Thumbor::CryptoURL.new key
20
- crypto.computed_key.should == 'my-security-keym'
21
- end
22
-
23
- end
24
-
25
- describe Thumbor::CryptoURL, "#url_for" do
26
- it "should return just the image hash if no arguments passed" do
27
- crypto = Thumbor::CryptoURL.new key
28
-
29
- url = crypto.url_for :image => image_url
30
-
31
- url.should == image_md5
32
- end
33
-
34
- it "should raise if no image passed" do
35
- crypto = Thumbor::CryptoURL.new key
36
-
37
- expect { crypto.url_for Hash.new }.to raise_error(RuntimeError)
38
- end
39
-
40
- it "should return proper url for width-only" do
41
- crypto = Thumbor::CryptoURL.new key
42
-
43
- url = crypto.url_for :image => image_url, :width => 300
44
-
45
- url.should == '300x0/' << image_md5
46
- end
47
-
48
- it "should return proper url for height-only" do
49
- crypto = Thumbor::CryptoURL.new key
50
-
51
- url = crypto.url_for :image => image_url, :height => 300
52
-
53
- url.should == '0x300/' << image_md5
54
- end
55
-
56
- it "should return proper url for width and height" do
57
- crypto = Thumbor::CryptoURL.new key
58
-
59
- url = crypto.url_for :image => image_url, :width => 200, :height => 300
60
-
61
- url.should == '200x300/' << image_md5
62
- end
63
-
64
- it "should return proper smart url" do
65
- crypto = Thumbor::CryptoURL.new key
66
-
67
- url = crypto.url_for :image => image_url, :width => 200, :height => 300, :smart => true
68
-
69
- url.should == '200x300/smart/' << image_md5
70
- end
71
-
72
- it "should return proper fit-in url" do
73
- crypto = Thumbor::CryptoURL.new key
74
-
75
- url = crypto.url_for :image => image_url, :width => 200, :height => 300, :fit_in => true
76
-
77
- url.should == 'fit-in/200x300/' << image_md5
78
- end
79
-
80
- it "should return proper flip url if no width and height" do
81
- crypto = Thumbor::CryptoURL.new key
82
-
83
- url = crypto.url_for :image => image_url, :flip => true
84
-
85
- url.should == '-0x0/' << image_md5
86
- end
87
-
88
- it "should return proper flop url if no width and height" do
89
- crypto = Thumbor::CryptoURL.new key
90
-
91
- url = crypto.url_for :image => image_url, :flop => true
92
-
93
- url.should == '0x-0/' << image_md5
94
- end
95
-
96
- it "should return proper flip-flop url if no width and height" do
97
- crypto = Thumbor::CryptoURL.new key
98
-
99
- url = crypto.url_for :image => image_url, :flip => true, :flop => true
100
-
101
- url.should == '-0x-0/' << image_md5
102
- end
103
-
104
- it "should return proper flip url if width" do
105
- crypto = Thumbor::CryptoURL.new key
106
-
107
- url = crypto.url_for :image => image_url, :width => 300, :flip => true
108
-
109
- url.should == '-300x0/' << image_md5
110
- end
111
-
112
- it "should return proper flop url if height" do
113
- crypto = Thumbor::CryptoURL.new key
114
-
115
- url = crypto.url_for :image => image_url, :height => 300, :flop => true
116
-
117
- url.should == '0x-300/' << image_md5
118
- end
119
-
120
- it "should return horizontal align" do
121
- crypto = Thumbor::CryptoURL.new key
122
-
123
- url = crypto.url_for :image => image_url, :halign => :left
124
-
125
- url.should == 'left/' << image_md5
126
- end
127
-
128
- it "should not return horizontal align if it is center" do
129
- crypto = Thumbor::CryptoURL.new key
130
-
131
- url = crypto.url_for :image => image_url, :halign => :center
132
-
133
- url.should == image_md5
134
- end
135
-
136
- it "should return vertical align" do
137
- crypto = Thumbor::CryptoURL.new key
138
-
139
- url = crypto.url_for :image => image_url, :valign => :top
140
-
141
- url.should == 'top/' << image_md5
142
- end
143
-
144
- it "should not return vertical align if it is middle" do
145
- crypto = Thumbor::CryptoURL.new key
146
-
147
- url = crypto.url_for :image => image_url, :valign => :middle
148
-
149
- url.should == image_md5
150
- end
151
-
152
- it "should return halign and valign properly" do
153
- crypto = Thumbor::CryptoURL.new key
154
-
155
- url = crypto.url_for :image => image_url, :halign => :left, :valign => :top
156
-
157
- url.should == 'left/top/' << image_md5
158
- end
159
-
160
- it "should return meta properly" do
161
- crypto = Thumbor::CryptoURL.new key
162
-
163
- url = crypto.url_for :image => image_url, :meta => true
164
-
165
- url.should == 'meta/' << image_md5
166
- end
167
-
168
- it "should return proper crop url" do
169
- crypto = Thumbor::CryptoURL.new key
170
-
171
- url = crypto.url_for :image => image_url, :crop => [10, 20, 30, 40]
172
-
173
- url.should == '10x20:30x40/' << image_md5
174
- end
175
-
176
- it "should ignore crop if all zeros" do
177
- crypto = Thumbor::CryptoURL.new key
178
-
179
- url = crypto.url_for :image => image_url, :crop => [0, 0, 0, 0]
180
-
181
- url.should == image_md5
182
- end
183
-
184
- it "should have smart after halign and valign" do
185
- crypto = Thumbor::CryptoURL.new key
186
-
187
- url = crypto.url_for :image => image_url, :halign => :left, :valign => :top, :smart => true
188
-
189
- url.should == 'left/top/smart/' << image_md5
190
- end
191
-
192
- it "should ignore filters if empty" do
193
- crypto = Thumbor::CryptoURL.new key
194
-
195
- url = crypto.url_for :image => image_url, :filters => []
196
-
197
- url.should == image_md5
198
- end
199
- end
200
-
201
- describe Thumbor::CryptoURL, "#generate" do
202
-
203
- before :each do
204
- @crypto = Thumbor::CryptoURL.new key
205
- end
206
-
207
- it "should create a new instance passing key and keep it" do
208
- url = @crypto.generate :width => 300, :height => 200, :image => image_url
209
-
210
- url.should == '/TQfyd3H36Z3srcNcLOYiM05YNO8=/300x200/my.domain.com/some/image/url.jpg'
211
- end
212
-
213
- it "should create a new instance passing key and keep it" do
214
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url
215
-
216
- url.should == '/YBQEWd3g_WRMnVEG73zfzcr8Zj0=/meta/300x200/my.domain.com/some/image/url.jpg'
217
- end
218
-
219
- it "should create a new instance passing key and keep it" do
220
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true
221
-
222
- url.should == '/jP89J0qOWHgPlm_lOA28GtOh5GU=/meta/300x200/smart/my.domain.com/some/image/url.jpg'
223
- end
224
-
225
- it "should create a new instance passing key and keep it" do
226
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :fit_in => true
227
-
228
- url.should == '/zrrOh_TtTs4kiLLEQq1w4bcTYdc=/meta/fit-in/300x200/smart/my.domain.com/some/image/url.jpg'
229
- end
230
-
231
- it "should create a new instance passing key and keep it" do
232
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :fit_in => true, :flip => true
233
-
234
- url.should == '/4t1XK1KH43cOb1QJ9tU00-W2_k8=/meta/fit-in/-300x200/smart/my.domain.com/some/image/url.jpg'
235
- end
236
-
237
- it "should create a new instance passing key and keep it" do
238
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :fit_in => true, :flip => true, :flop => true
239
-
240
- url.should == '/HJnvjZU69PkPOhyZGu-Z3Uc_W_A=/meta/fit-in/-300x-200/smart/my.domain.com/some/image/url.jpg'
241
- end
242
-
243
- it "should create a new instance passing key and keep it" do
244
- url = @crypto.generate :filters => ["quality(20)", "brightness(10)"], :image => image_url
245
-
246
- url.should == '/q0DiFg-5-eFZIqyN3lRoCvg2K0s=/filters:quality(20):brightness(10)/my.domain.com/some/image/url.jpg'
247
- end
248
-
249
- end
250
-
251
- describe Thumbor::CryptoURL, "#generate :old => true" do
252
-
253
- before :each do
254
- @crypto = Thumbor::CryptoURL.new key
255
- end
256
-
257
- it "should create a new instance passing key and keep it" do
258
- url = @crypto.generate :width => 300, :height => 200, :image => image_url, :old => true
259
-
260
- url.should == '/qkLDiIbvtiks0Up9n5PACtmpOfX6dPXw4vP4kJU-jTfyF6y1GJBJyp7CHYh1H3R2/' << image_url
261
- end
262
-
263
- it "should allow thumbor to decrypt it properly" do
264
- url = @crypto.generate :width => 300, :height => 200, :image => image_url, :old => true
265
-
266
- encrypted = url.split('/')[1]
267
-
268
- decrypted = decrypt_in_thumbor(encrypted)
269
-
270
- decrypted["horizontal_flip"].should == false
271
- decrypted["vertical_flip"].should == false
272
- decrypted["smart"].should == false
273
- decrypted["meta"].should == false
274
- decrypted["fit_in"].should == false
275
- decrypted["crop"]["left"].should == 0
276
- decrypted["crop"]["top"].should == 0
277
- decrypted["crop"]["right"].should == 0
278
- decrypted["crop"]["bottom"].should == 0
279
- decrypted["valign"].should == 'middle'
280
- decrypted["halign"].should == 'center'
281
- decrypted["image_hash"].should == image_md5
282
- decrypted["width"].should == 300
283
- decrypted["height"].should == 200
284
-
285
- end
286
-
287
- it "should allow thumbor to decrypt it properly with meta" do
288
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :old => true
289
-
290
- encrypted = url.split('/')[1]
291
-
292
- decrypted = decrypt_in_thumbor(encrypted)
293
-
294
- decrypted["meta"].should == true
295
- decrypted["image_hash"].should == image_md5
296
- decrypted["width"].should == 300
297
- decrypted["height"].should == 200
298
-
299
- end
300
-
301
- it "should allow thumbor to decrypt it properly with smart" do
302
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :old => true
303
-
304
- encrypted = url.split('/')[1]
305
-
306
- decrypted = decrypt_in_thumbor(encrypted)
307
-
308
- decrypted["meta"].should == true
309
- decrypted["smart"].should == true
310
- decrypted["image_hash"].should == image_md5
311
- decrypted["width"].should == 300
312
- decrypted["height"].should == 200
313
-
314
- end
315
-
316
- it "should allow thumbor to decrypt it properly with fit-in" do
317
- url = @crypto.generate :width => 300, :height => 200, :fit_in => true, :image => image_url, :old => true
318
-
319
- encrypted = url.split('/')[1]
320
-
321
- decrypted = decrypt_in_thumbor(encrypted)
322
-
323
- decrypted["fit_in"].should == true
324
- decrypted["image_hash"].should == image_md5
325
- decrypted["width"].should == 300
326
- decrypted["height"].should == 200
327
-
328
- end
329
-
330
- it "should allow thumbor to decrypt it properly with flip" do
331
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :flip => true, :old => true
332
-
333
- encrypted = url.split('/')[1]
334
-
335
- decrypted = decrypt_in_thumbor(encrypted)
336
-
337
- decrypted["meta"].should == true
338
- decrypted["smart"].should == true
339
- decrypted["image_hash"].should == image_md5
340
- decrypted["width"].should == 300
341
- decrypted["height"].should == 200
342
- decrypted["flip_horizontally"] == true
343
-
344
- end
345
-
346
- it "should allow thumbor to decrypt it properly with flop" do
347
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :flip => true, :flop => true, :old => true
348
-
349
- encrypted = url.split('/')[1]
350
-
351
- decrypted = decrypt_in_thumbor(encrypted)
352
-
353
- decrypted["meta"].should == true
354
- decrypted["smart"].should == true
355
- decrypted["image_hash"].should == image_md5
356
- decrypted["width"].should == 300
357
- decrypted["height"].should == 200
358
- decrypted["flip_horizontally"] == true
359
- decrypted["flip_vertically"] == true
360
-
361
- end
362
-
363
- it "should allow thumbor to decrypt it properly with halign" do
364
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :flip => true, :flop => true,
365
- :halign => :left, :old => true
366
-
367
- encrypted = url.split('/')[1]
368
-
369
- decrypted = decrypt_in_thumbor(encrypted)
370
-
371
- decrypted["meta"].should == true
372
- decrypted["smart"].should == true
373
- decrypted["image_hash"].should == image_md5
374
- decrypted["width"].should == 300
375
- decrypted["height"].should == 200
376
- decrypted["flip_horizontally"] == true
377
- decrypted["flip_vertically"] == true
378
- decrypted["halign"] == "left"
379
-
380
- end
381
-
382
- it "should allow thumbor to decrypt it properly with valign" do
383
- url = @crypto.generate :width => 300, :height => 200, :meta => true, :image => image_url, :smart => true, :flip => true, :flop => true,
384
- :halign => :left, :valign => :top, :old => true
385
-
386
- encrypted = url.split('/')[1]
387
-
388
- decrypted = decrypt_in_thumbor(encrypted)
389
-
390
- decrypted["meta"].should == true
391
- decrypted["smart"].should == true
392
- decrypted["image_hash"].should == image_md5
393
- decrypted["width"].should == 300
394
- decrypted["height"].should == 200
395
- decrypted["flip_horizontally"] == true
396
- decrypted["flip_vertically"] == true
397
- decrypted["halign"] == "left"
398
- decrypted["valign"] == "top"
399
-
400
- end
401
-
402
- it "should allow thumbor to decrypt it properly with cropping" do
403
- url = @crypto.generate :width => 300, :height => 200, :image => image_url, :crop => [10, 20, 30, 40], :old => true
404
-
405
- encrypted = url.split('/')[1]
406
-
407
- decrypted = decrypt_in_thumbor(encrypted)
408
-
409
- decrypted["horizontal_flip"].should == false
410
- decrypted["vertical_flip"].should == false
411
- decrypted["smart"].should == false
412
- decrypted["meta"].should == false
413
- decrypted["crop"]["left"].should == 10
414
- decrypted["crop"]["top"].should == 20
415
- decrypted["crop"]["right"].should == 30
416
- decrypted["crop"]["bottom"].should == 40
417
- decrypted["valign"].should == 'middle'
418
- decrypted["halign"].should == 'center'
419
- decrypted["image_hash"].should == image_md5
420
- decrypted["width"].should == 300
421
- decrypted["height"].should == 200
422
-
423
- end
424
-
425
- it "should allow thumbor to decrypt it properly with filters" do
426
- url = @crypto.generate :filters => ["quality(20)", "brightness(10)"], :image => image_url, :old => true
427
-
428
- encrypted = url.split('/')[1]
429
-
430
- decrypted = decrypt_in_thumbor(encrypted)
431
-
432
- decrypted["filters"].should == "quality(20):brightness(10)"
433
- end
434
-
435
-
436
- end