cloudinary 1.0.61 → 1.0.62
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/lib/cloudinary.rb +2 -1
- data/lib/cloudinary/utils.rb +10 -7
- data/lib/cloudinary/version.rb +1 -1
- data/spec/utils_spec.rb +4 -4
- metadata +2 -2
data/README.md
CHANGED
@@ -53,19 +53,19 @@ Accessing an uploaded image with the `sample` public ID through a CDN:
|
|
53
53
|
|
54
54
|
http://res.cloudinary.com/demo/image/upload/sample.jpg
|
55
55
|
|
56
|
-
![Sample](https://cloudinary
|
56
|
+
![Sample](https://res.cloudinary.com/demo/image/upload/w_0.4/sample.jpg "Sample")
|
57
57
|
|
58
58
|
Generating a 150x100 version of the `sample` image and downloading it through a CDN:
|
59
59
|
|
60
60
|
http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg
|
61
61
|
|
62
|
-
![Sample 150x100](https://cloudinary
|
62
|
+
![Sample 150x100](https://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg "Sample 150x100")
|
63
63
|
|
64
64
|
Converting to a 150x100 PNG with rounded corners of 20 pixels:
|
65
65
|
|
66
66
|
http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png
|
67
67
|
|
68
|
-
![Sample 150x150 Rounded PNG](https://cloudinary
|
68
|
+
![Sample 150x150 Rounded PNG](https://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png "Sample 150x150 Rounded PNG")
|
69
69
|
|
70
70
|
For plenty more transformation options, see our [image transformations documentation](http://cloudinary.com/documentation/image_transformations).
|
71
71
|
|
@@ -73,7 +73,7 @@ Generating a 120x90 thumbnail based on automatic face detection of the Facebook
|
|
73
73
|
|
74
74
|
http://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg
|
75
75
|
|
76
|
-
![Facebook 90x120](https://cloudinary
|
76
|
+
![Facebook 90x120](https://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg "Facebook 90x200")
|
77
77
|
|
78
78
|
For more details, see our documentation for embedding [Facebook](http://cloudinary.com/documentation/facebook_profile_pictures) and [Twitter](http://cloudinary.com/documentation/twitter_profile_pictures) profile pictures.
|
79
79
|
|
data/lib/cloudinary.rb
CHANGED
@@ -23,7 +23,8 @@ module Cloudinary
|
|
23
23
|
autoload :CarrierWave, "cloudinary/carrier_wave"
|
24
24
|
|
25
25
|
CF_SHARED_CDN = "d3jpl91pxevbkh.cloudfront.net"
|
26
|
-
AKAMAI_SHARED_CDN = "cloudinary
|
26
|
+
AKAMAI_SHARED_CDN = "res.cloudinary.com"
|
27
|
+
OLD_AKAMAI_SHARED_CDN = "cloudinary-a.akamaihd.net"
|
27
28
|
SHARED_CDN = AKAMAI_SHARED_CDN
|
28
29
|
|
29
30
|
FORMAT_ALIASES = {
|
data/lib/cloudinary/utils.rb
CHANGED
@@ -137,19 +137,22 @@ class Cloudinary::Utils
|
|
137
137
|
source = "#{source}.#{format}"
|
138
138
|
end
|
139
139
|
|
140
|
-
if cloud_name.start_with?("/")
|
140
|
+
if cloud_name.start_with?("/") # For development
|
141
141
|
prefix = "/res" + cloud_name
|
142
|
-
else
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
else
|
143
|
+
shared_domain = !private_cdn
|
144
|
+
if secure
|
145
|
+
if secure_distribution.nil? || secure_distribution == Cloudinary::OLD_AKAMAI_SHARED_CDN
|
146
|
+
secure_distribution = private_cdn ? "#{cloud_name}-res.cloudinary.com" : Cloudinary::SHARED_CDN
|
147
|
+
end
|
148
|
+
shared_domain ||= secure_distribution == Cloudinary::SHARED_CDN
|
146
149
|
prefix = "https://#{secure_distribution}"
|
147
150
|
else
|
148
151
|
subdomain = cdn_subdomain ? "a#{(Zlib::crc32(source) % 5) + 1}." : ""
|
149
152
|
host = cname.blank? ? "#{private_cdn ? "#{cloud_name}-" : ""}res.cloudinary.com" : cname
|
150
153
|
prefix = "http://#{subdomain}#{host}"
|
151
|
-
end
|
152
|
-
prefix += "/#{cloud_name}" if
|
154
|
+
end
|
155
|
+
prefix += "/#{cloud_name}" if shared_domain
|
153
156
|
end
|
154
157
|
|
155
158
|
if shorten && resource_type.to_s == "image" && type.to_s == "upload"
|
data/lib/cloudinary/version.rb
CHANGED
data/spec/utils_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe Cloudinary::Utils do
|
|
32
32
|
options = {:secure=>true}
|
33
33
|
result = Cloudinary::Utils.cloudinary_url("test", options)
|
34
34
|
options.should == {}
|
35
|
-
result.should == "https://cloudinary
|
35
|
+
result.should == "https://res.cloudinary.com/test123/image/upload/test"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should allow overriding secure distribution if secure=true" do
|
@@ -54,7 +54,7 @@ describe Cloudinary::Utils do
|
|
54
54
|
options = {:secure=>true, :private_cdn=>true}
|
55
55
|
result = Cloudinary::Utils.cloudinary_url("test", options)
|
56
56
|
options.should == {}
|
57
|
-
result.should == "https://
|
57
|
+
result.should == "https://test123-res.cloudinary.com/image/upload/test"
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should not add cloud_name if secure private_cdn and secure non akamai secure_distribution" do
|
@@ -316,7 +316,7 @@ describe Cloudinary::Utils do
|
|
316
316
|
options = {:ssl_detected=>true}
|
317
317
|
result = Cloudinary::Utils.cloudinary_url("test", options)
|
318
318
|
options.should == {}
|
319
|
-
result.should == "https://cloudinary
|
319
|
+
result.should == "https://res.cloudinary.com/test123/image/upload/test"
|
320
320
|
end
|
321
321
|
|
322
322
|
it "should use secure if given over ssl_detected and configuration" do
|
@@ -332,7 +332,7 @@ describe Cloudinary::Utils do
|
|
332
332
|
Cloudinary.config.secure = true
|
333
333
|
result = Cloudinary::Utils.cloudinary_url("test", options)
|
334
334
|
options.should == {}
|
335
|
-
result.should == "https://cloudinary
|
335
|
+
result.should == "https://res.cloudinary.com/test123/image/upload/test"
|
336
336
|
end
|
337
337
|
|
338
338
|
it "should support extenal cname" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudinary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.62
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-07-
|
14
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|