ruby-thumbor 0.4.0 → 0.5.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.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.5.0 2011-04-19
2
+
3
+ * 1 major enhancement:
4
+ * Fit-in support in the url
5
+
1
6
  === 0.0.1 2011-04-02
2
7
 
3
8
  * 1 major enhancement:
data/PostInstall.txt CHANGED
@@ -1,3 +1,3 @@
1
1
 
2
- For more information on ruby-thumbor, see http://ruby-thumbor.rubyforge.org
2
+ For more information on ruby-thumbor, see https://rubygems.org/gems/ruby-thumbor.
3
3
 
data/lib/ruby-thumbor.rb CHANGED
@@ -6,7 +6,7 @@ require 'base64'
6
6
  require 'digest/md5'
7
7
 
8
8
  module Thumbor
9
- VERSION = '0.4.0'
9
+ VERSION = '0.5.0'
10
10
 
11
11
  class CryptoURL
12
12
  attr_accessor :key
@@ -76,6 +76,10 @@ module Thumbor
76
76
  end
77
77
  end
78
78
 
79
+ if options[:fit_in]:
80
+ url_parts.push('fit-in')
81
+ end
82
+
79
83
  calculate_width_and_height(url_parts, options)
80
84
 
81
85
  if options[:halign] and options[:halign] != :center
@@ -69,6 +69,14 @@ describe Thumbor::CryptoURL, "#url_for" do
69
69
  url.should == '200x300/smart/' << image_md5
70
70
  end
71
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
+
72
80
  it "should return proper flip url if no width and height" do
73
81
  crypto = Thumbor::CryptoURL.new key
74
82
 
@@ -206,6 +214,7 @@ describe Thumbor::CryptoURL, "#generate" do
206
214
  decrypted["vertical_flip"].should == false
207
215
  decrypted["smart"].should == false
208
216
  decrypted["meta"].should == false
217
+ decrypted["fit_in"].should == false
209
218
  decrypted["crop"]["left"].should == 0
210
219
  decrypted["crop"]["top"].should == 0
211
220
  decrypted["crop"]["right"].should == 0
@@ -251,6 +260,23 @@ describe Thumbor::CryptoURL, "#generate" do
251
260
 
252
261
  end
253
262
 
263
+ it "should allow thumbor to decrypt it properly with fit-in" do
264
+
265
+ crypto = Thumbor::CryptoURL.new key
266
+
267
+ url = crypto.generate :width => 300, :height => 200, :fit_in => true, :image => image_url
268
+
269
+ encrypted = url.split('/')[1]
270
+
271
+ decrypted = decrypt_in_thumbor(encrypted)
272
+
273
+ decrypted["fit_in"].should == true
274
+ decrypted["image_hash"].should == image_md5
275
+ decrypted["width"].should == 300
276
+ decrypted["height"].should == 200
277
+
278
+ end
279
+
254
280
  it "should allow thumbor to decrypt it properly with flip" do
255
281
  crypto = Thumbor::CryptoURL.new key
256
282
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-thumbor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 0.4.0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bernardo Heynemann
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-04 00:00:00 -03:00
18
+ date: 2011-04-19 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency