cloudinary 1.0.42 → 1.0.43
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cloudinary/api.rb +1 -1
- data/lib/cloudinary/helper.rb +25 -0
- data/lib/cloudinary/utils.rb +4 -1
- data/lib/cloudinary/version.rb +1 -1
- data/spec/utils_spec.rb +4 -0
- metadata +2 -2
data/lib/cloudinary/api.rb
CHANGED
@@ -40,7 +40,7 @@ class Cloudinary::Api
|
|
40
40
|
resource_type = options[:resource_type] || "image"
|
41
41
|
type = options[:type] || "upload"
|
42
42
|
uri = "resources/#{resource_type}/#{type}/#{public_id}"
|
43
|
-
call_api(:get, uri, only(options, :colors, :exif, :faces, :max_results), options)
|
43
|
+
call_api(:get, uri, only(options, :colors, :exif, :faces, :pages, :max_results), options)
|
44
44
|
end
|
45
45
|
|
46
46
|
def self.delete_resources(public_ids, options={})
|
data/lib/cloudinary/helper.rb
CHANGED
@@ -13,6 +13,7 @@ module CloudinaryHelper
|
|
13
13
|
options[:width] = options.delete(:html_width) if options.include?(:html_width)
|
14
14
|
options[:height] = options.delete(:html_height) if options.include?(:html_height)
|
15
15
|
options[:size] = options.delete(:html_size) if options.include?(:html_size)
|
16
|
+
options[:border] = options.delete(:html_border) if options.include?(:html_border)
|
16
17
|
|
17
18
|
original_image_tag(source, options)
|
18
19
|
end
|
@@ -48,18 +49,42 @@ module CloudinaryHelper
|
|
48
49
|
def facebook_profile_image_tag(profile, options = {})
|
49
50
|
cl_image_tag(profile, {:type=>:facebook}.merge(options))
|
50
51
|
end
|
52
|
+
|
53
|
+
def facebook_profile_image_path(profile, options = {})
|
54
|
+
cl_image_path(profile, {:type=>:facebook}.merge(options))
|
55
|
+
end
|
51
56
|
|
52
57
|
def gravatar_profile_image_tag(email, options = {})
|
53
58
|
cl_image_tag(Digest::MD5.hexdigest(email.strip.downcase), {:type=>:gravatar, :format=>:jpg}.merge(options))
|
54
59
|
end
|
60
|
+
|
61
|
+
def gravatar_profile_image_path(email, options = {})
|
62
|
+
cl_image_path(Digest::MD5.hexdigest(email.strip.downcase), {:type=>:gravatar, :format=>:jpg}.merge(options))
|
63
|
+
end
|
55
64
|
|
56
65
|
def twitter_profile_image_tag(profile, options = {})
|
57
66
|
cl_image_tag(profile, {:type=>:twitter}.merge(options))
|
58
67
|
end
|
68
|
+
|
69
|
+
def twitter_profile_image_path(profile, options = {})
|
70
|
+
cl_image_path(profile, {:type=>:twitter}.merge(options))
|
71
|
+
end
|
59
72
|
|
60
73
|
def twitter_name_profile_image_tag(profile, options = {})
|
61
74
|
cl_image_tag(profile, {:type=>:twitter_name}.merge(options))
|
62
75
|
end
|
76
|
+
|
77
|
+
def twitter_name_profile_image_path(profile, options = {})
|
78
|
+
cl_image_path(profile, {:type=>:twitter_name}.merge(options))
|
79
|
+
end
|
80
|
+
|
81
|
+
def gplus_profile_image_tag(profile, options = {})
|
82
|
+
cl_image_tag(profile, {:type=>:gplus}.merge(options))
|
83
|
+
end
|
84
|
+
|
85
|
+
def gplus_profile_image_path(profile, options = {})
|
86
|
+
cl_image_path(profile, {:type=>:gplus}.merge(options))
|
87
|
+
end
|
63
88
|
|
64
89
|
def cl_sprite_url(source, options = {})
|
65
90
|
options = options.clone
|
data/lib/cloudinary/utils.rb
CHANGED
@@ -51,11 +51,14 @@ class Cloudinary::Utils
|
|
51
51
|
border = options.delete(:border)
|
52
52
|
if border.is_a?(Hash)
|
53
53
|
border = "#{border[:width] || 2}px_solid_#{(border[:color] || "black").sub(/^#/, 'rgb:')}"
|
54
|
+
elsif border.to_s =~ /^\d+$/ # fallback to html border attribute
|
55
|
+
options[:border] = border
|
56
|
+
border = nil
|
54
57
|
end
|
55
58
|
flags = build_array(options.delete(:flags)).join(".")
|
56
59
|
|
57
60
|
params = {:w=>width, :h=>height, :t=>named_transformation, :c=>crop, :b=>background, :e=>effect, :a=>angle, :bo=>border, :fl=>flags}
|
58
|
-
{ :x=>:x, :y=>:y, :r=>:radius, :d=>:default_image, :g=>:gravity, :q=>:quality, :cs=>:color_space,
|
61
|
+
{ :x=>:x, :y=>:y, :r=>:radius, :d=>:default_image, :g=>:gravity, :q=>:quality, :cs=>:color_space, :o=>:opacity,
|
59
62
|
:p=>:prefix, :l=>:overlay, :u=>:underlay, :f=>:fetch_format, :dn=>:density, :pg=>:page, :dl=>:delay
|
60
63
|
}.each do
|
61
64
|
|param, option|
|
data/lib/cloudinary/version.rb
CHANGED
data/spec/utils_spec.rb
CHANGED
@@ -323,6 +323,10 @@ describe Cloudinary::Utils do
|
|
323
323
|
result = Cloudinary::Utils.cloudinary_url("test", options)
|
324
324
|
options.should == {}
|
325
325
|
result.should == "http://res.cloudinary.com/test123/image/upload/bo_1px_solid_blue/test"
|
326
|
+
options = {"border"=>"2"}
|
327
|
+
result = Cloudinary::Utils.cloudinary_url("test", options)
|
328
|
+
options.should == {:border=>"2"}
|
329
|
+
result.should == "http://res.cloudinary.com/test123/image/upload/test"
|
326
330
|
end
|
327
331
|
|
328
332
|
it "should support flags" 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.43
|
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: 2012-
|
14
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|