cloudinary 1.0.22 → 1.0.23

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.
@@ -32,7 +32,7 @@ class Cloudinary::Utils
32
32
  end
33
33
 
34
34
  params = {:w=>width, :h=>height, :t=>named_transformation, :c=>crop, :b=>background}
35
- { :x=>:x, :y=>:y, :r=>:radius, :d=>:default_image, :g=>:gravity, :q=>:quality, :p=>:prefix, :a=>:angle, :l=>:overlay }.each do
35
+ { :x=>:x, :y=>:y, :r=>:radius, :d=>:default_image, :g=>:gravity, :q=>:quality, :p=>:prefix, :a=>:angle, :l=>:overlay, :f=>:fetch_format, :e=>:effects }.each do
36
36
  |param, option|
37
37
  params[param] = options.delete(option)
38
38
  end
@@ -50,10 +50,11 @@ class Cloudinary::Utils
50
50
 
51
51
  # Warning: options are being destructively updated!
52
52
  def self.cloudinary_url(source, options = {})
53
- original_source = source
53
+ type = options.delete(:type)
54
+
55
+ options[:fetch_format] ||= options.delete(:format) if type == :fetch
54
56
  transformation = self.generate_transformation_string(options)
55
57
 
56
- type = options.delete(:type)
57
58
  resource_type = options.delete(:resource_type) || "image"
58
59
  version = options.delete(:version)
59
60
  format = options.delete(:format)
@@ -64,6 +65,7 @@ class Cloudinary::Utils
64
65
  secure_distribution = options.delete(:secure_distribution) || Cloudinary.config.secure_distribution
65
66
  force_remote = options.delete(:force_remote)
66
67
 
68
+ original_source = source
67
69
  return original_source if source.blank?
68
70
  if !force_remote
69
71
  return original_source if (type.nil? || type == :asset) && source.match(%r(^https?:/)i)
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.22"
3
+ VERSION = "1.0.23"
4
4
  end
data/spec/utils_spec.rb CHANGED
@@ -199,4 +199,18 @@ describe Cloudinary::Utils do
199
199
  result.should == "http://res.cloudinary.com/test123/image/upload/l_text:hello/test"
200
200
  end
201
201
 
202
+ it "should support format for fetch urls" do
203
+ options = {:format=>"jpg", :type=>:fetch}
204
+ result = Cloudinary::Utils.cloudinary_url("http://cloudinary.com/images/logo.png", options)
205
+ options.should == {}
206
+ result.should == "http://res.cloudinary.com/test123/image/fetch/f_jpg/http://cloudinary.com/images/logo.png"
207
+ end
208
+
209
+ it "should support effects" do
210
+ options = {:effects=>"sepia"}
211
+ result = Cloudinary::Utils.cloudinary_url("test", options)
212
+ options.should == {}
213
+ result.should == "http://res.cloudinary.com/test123/image/upload/e_sepia/test"
214
+ end
215
+
202
216
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cloudinary
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.22
5
+ version: 1.0.23
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nadav Soferman
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2012-05-10 00:00:00 +03:00
15
+ date: 2012-05-14 00:00:00 +03:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency