cloudinary 1.0.63 → 1.0.64

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/CHANGELOG ADDED
@@ -0,0 +1,300 @@
1
+ = Version 1.0.64 - 2013-10-17
2
+ * Extracted upload_tag_params and upload_url from image_upload_tag. Extracted common code to sign_request.
3
+ * Updated Cloudinary's jQuery plugin to v1.0.10: Binding jQuery file upload events.
4
+ * Support line_spacing text parameter.
5
+ * Added code documentation for cl_image_tag.
6
+
7
+ = Version 1.0.63 - 2013-08-07
8
+ * Support folder parameter.
9
+ * Escape non-http public_ids.
10
+ * Correct escaping of space and '-'.
11
+
12
+ = Version 1.0.62 - 2013-07-30
13
+ * Change secure urls to use *res.cloudinary.com.
14
+
15
+ = Version 1.0.61 - 2013-07-18
16
+ * Mongoid 4 compatibility fix.
17
+ * Support raw data URI.
18
+ * Issue #81 - Error on bootstrap + rails under Rails 4.
19
+ * Support admin ping API.
20
+ * Include updated jQuery plugin.
21
+
22
+ = Version 1.0.60 - 2013-07-01
23
+ * Upgrade to latest jQuery file upload.
24
+ * Support whitelisted S3 URLs in upload.
25
+
26
+ = Version 1.0.59 - 2013-06-13
27
+ * Support discard_original_filename.
28
+ * Support proxy parameter in upload.
29
+
30
+ = Version 1.0.58 - 2013-05-16
31
+ * cloudinary_url helper should protect options from modification.
32
+ * Add jpc jp2 psd to list of support image formats.
33
+ * Crop mode lfill support.
34
+
35
+ = Version 1.0.57 - 2013-05-01
36
+ * Allow my_public_id to be called from versions.
37
+ * Fix for giving :version parameters to url in version while overriding public_id.
38
+
39
+ = Version 1.0.56 - 2013-04-24
40
+ * Support for uploading raw files in direct upload with CarrierWave.
41
+ * Support overriding stored version.
42
+
43
+ = Version 1.0.55 - 2013-04-19
44
+ * Support folders in PreloadedFile.
45
+ * Allow cloudinary helpers to work directly with CarrierWave uploaders.
46
+ * Issue #70 - Return parsed error message for 401,403 and 404 error codes as well.
47
+ * CarrierWave - allow returning format in dynamic methods.
48
+
49
+ = Version 1.0.54 - 2013-04-05
50
+ * Support auto-rename when public_id has random component.
51
+
52
+ = Version 1.0.53 - 2013-04-04
53
+ * Fix handling of non-fetch http urls.
54
+ * Support attachment flag in private download links.
55
+
56
+ = Version 1.0.52 - 2013-03-29
57
+ * Support for unsafe transformation update (Admin API).
58
+
59
+ = Version 1.0.51 - 2013-03-28
60
+ * Fixing issue #66 - folder names are not respected in non-direct uploads.
61
+ * Fixing issue #65 - allow overwriting existing images when updating preloaded images.
62
+ * Support ERB in cloudinary.yml.
63
+
64
+ = Version 1.0.50 - 2013-03-24
65
+ * Support folders.
66
+ * Short URLs.
67
+ * Auto rename of preloaded resources in CarrierWave.
68
+
69
+ = Version 1.0.49 - 2013-03-21
70
+ * Support for renaming public_ids.
71
+ * Safe handling of booleans to prevent issues with Firefox json deserialization.
72
+ * Uploader tests.
73
+
74
+ = Version 1.0.48 - 2013-03-20
75
+ * Add missing require of rest_client.
76
+ * Support for rails4 sass asset path integration.
77
+ * Flag to prevent cloudinary from downloading remote urls directly.
78
+ * Issue #61 build_upload_params destructively updates options.
79
+
80
+ = Version 1.0.47 - 2013-03-14
81
+ * Allow overriding config with nil/false.
82
+ * Akamai CDN support.
83
+
84
+ = Version 1.0.46 - 2013-03-10
85
+ * Support for tags flag in resources listing API.
86
+ * Initial partial support for Rails 4.
87
+
88
+ = Version 1.0.45 - 2013-02-28
89
+ * Ignore blank URI to support empty string in remote_image_url.
90
+ * Issue #48 - Allow carrier wave upload to be given to url/image methods.
91
+ * Support for explode and multi API. Support async and notification, Correctly delete raw resources uploaded via CarrierWave.
92
+
93
+ = Version 1.0.44 - 2013-02-05
94
+ * Support new usage API call.
95
+ * Support image_metadata in upload and API.
96
+ * Javascript index file for client side processing in jQuery File Upload.
97
+ * Support use_filename flag.
98
+ * Added license to the gems specification.
99
+
100
+ = Version 1.0.43 - 2012-12-18
101
+ * Support fallback to html border attribute.
102
+ * Added Google+ Helpers.
103
+ * Additional Helper Methods.
104
+ * Add cl_image_path for social images.
105
+ * Allow giving pages flag to resource details API.
106
+ * Support opacity flag.
107
+
108
+ = Version 1.0.42 - 2012-11-14
109
+ * Raise CloudinaryException instead of string everywhere.
110
+ * Support expires_at in private download.
111
+ * Support info flags directly on upload.
112
+
113
+ = Version 1.0.41 - 2012-10-28
114
+ * Allow Cloudinary.config_from_url to be called before Cloudinary.config.
115
+ * Normalize file extensions in carrier wave upload.
116
+ * Support keep_original in resource deletion.
117
+ * Support delete_resources_by_tag, Support for transformation flags.
118
+
119
+ = Version 1.0.40 - 2012-10-10
120
+ * Carrierwave - downcase wanted format.
121
+
122
+ = Version 1.0.39 - 2012-10-08
123
+ * Support max_results in resource drilldown.
124
+ * Change delete_resources_by_prefix to match other signatures.
125
+ * Add Cloudinary.config_from_url to use CLOUDINARY_URL even if not from env.
126
+
127
+ = Version 1.0.38 - 2012-10-02
128
+ * Support additional parameters (border, color space, delay).
129
+ * Admin API enhancements.
130
+ * Carrierwave improvments for authenticated imaged.
131
+ * Allow URI to be used in cloudinary_url, minor fixes.
132
+
133
+ = Version 1.0.37 - 2012-09-12
134
+ * Support for customer headers.
135
+ * Support for type in tags.
136
+ * Support for tags in explicit.
137
+
138
+ = Version 1.0.36 - 2012-09-09
139
+ * Support storage type in CarrierWave.
140
+ * Check if resource exists.
141
+ * Public ID should never start with a digit
142
+ * Authenticated resources fixes.
143
+
144
+ = Version 1.0.35 - 2012-08-27
145
+ * Fix migrator to support retrieve returning a URL.
146
+
147
+ = Version 1.0.34 - 2012-08-27
148
+ * Extract PreloadedFile for easy handling of files preloaded by the Cloudinary's jQuery library.
149
+ * Don't pass width/height to html in case of fit/limit or angle are used.
150
+
151
+ = Version 1.0.33 - 2012-08-05
152
+ * Allow specifying angle as array.
153
+ * Allow specifying array of transformations directly.
154
+ * Allow using string keys in transformations.
155
+ * Support for Cloudinary new admin API.
156
+ * Support for signed authenticated URLs.
157
+
158
+ = Version 1.0.32 - 2012-07-26
159
+ * Fix typo in eager support for the explicit API.
160
+ * Better handling of escaping in URL parameters.
161
+ * Support passing transformation to all versions (process_all_versions).
162
+ * Support private mode (make_private).
163
+
164
+ = Version 1.0.31 - 2013-07-18
165
+ * Support configurable CNAME.
166
+ * Support for explicitly creating remote resources.
167
+
168
+ = Version 1.0.30 - 2012-07-12
169
+ * Force order of including in javascript for asset pipeline.
170
+ * Support for ZIP download link.
171
+
172
+ = Version 1.0.29 - 2012-07-08
173
+ * Page and density parameters.
174
+ * data-uri upload support.
175
+ * Allow CarrierWave enable_processing.
176
+ * Default rake task to spec & ignore Gemfile.lock.
177
+
178
+ = Version 1.0.28 - 2012-07-03
179
+ * default_public_id for CarrrierWave and JS asset packaging
180
+
181
+ = Version 1.0.27 - 2012-06-26
182
+ * Underlay support.
183
+ * Backup flag.
184
+ * Private resource download link.
185
+ * Secure flag fix.
186
+ * cloud_name param in API calls.
187
+
188
+ = Version 1.0.26 - 2012-06-08
189
+ * Fix issue 13 - rails-admin conflict.
190
+
191
+ = Version 1.0.25 - 2012-06-05
192
+ * Issues 18 (mongoid) and 19 (mount_on).
193
+
194
+ = Version 1.0.24 - 2012-05-17
195
+ * Renaming effects parameter and add numberic effect parameter.
196
+
197
+ = Version 1.0.23 - 2012-05-14
198
+ * Support fetch format and effects parameters.
199
+
200
+ = Version 1.0.21 - 2012-05-10
201
+ * Custom dynamic CarrierWave process method support.
202
+
203
+ = Version 1.0.21 - 2012-05-09
204
+ * New paramters (angle, overlay).
205
+ * Text creation.
206
+ * Fix issue 16.
207
+
208
+ = Version 1.0.20 - 2012-05-06
209
+ * Heroku single environment variable.
210
+
211
+ = Version 1.0.18 - 2012-05-02
212
+ * Sanitize filename for carrierwave to allow special characters in public_id.
213
+ * Allow preloaded image with empty format (for raw files).
214
+
215
+ = Version 1.0.17 - 2012-04-28
216
+ * Fix issue 12 - tags didn't work in newer versions of carrierwave. Validate tags are not used in versions.
217
+
218
+ = Version 1.0.16 - 2012-04-25
219
+ * Background color support.
220
+ * Add full_public_id method for accessing versioned public_id. Handle unversioned public_ids from DB.
221
+ * Removing options passed to image_path from cl_image_path.
222
+ * Better handling of public_id from stored value.
223
+ * Major CarrierWave plugin cleanup. Fix issue 10. Allow overriding public_id with dynamic public_id. Allow overriding delete_remote? to prevent deleting resources from Cloudinary.
224
+ * Fix issue #11 - nil input to image_tag throws exception.
225
+ * Fix docs, fix sass require.
226
+
227
+ = Version 1.0.15 - 2012-04-23
228
+ * Avoiding id attributes on hidden fields.
229
+ * Skip hidden tags for empty values.
230
+ * cl_form_tag: avoiding id attributes on hidden fields.
231
+ * Update timestamp in static file only if uploaded. Allow single hash in :eager. Do not consume options in :transformation.
232
+ * Remove active_support dependency from static.
233
+ * Always return original source if cloudinary is not used.
234
+ * Support cloudinary-url function in sass.
235
+ * Cleaner depdency check for sass and sass-rails.
236
+
237
+ = Version 1.0.14 - 2012-04-23
238
+ * Remove depenedency on active support.
239
+ * Allow non-Rails use of cloudinary.yml.
240
+ * Fix update of local url in carrir wave.
241
+ * Allow supplying DELETE_MISSING flag in static rake task.
242
+ * Disable recreate_versions! as it is not needed.
243
+
244
+ = Version 1.0.13 - 2012-04-22
245
+ * Default image support.
246
+
247
+ = Version 1.0.12 - 2012-04-19
248
+ * Fixing resize_to_pad to be resize_and_pad.
249
+
250
+ = Version 1.0.11 - 2012-04-19
251
+ * Better config initialization.
252
+ * Fix bug when non-static resource is requested and a static resource existing with the same name.
253
+ * Gravatar support.
254
+
255
+ = Version 1.0.10 - 2012-04-18
256
+ * Initial tests. Size option fix.
257
+ * Better rails dependency support.
258
+ * First version of cloudinary_js integration including file upload.
259
+
260
+ = Version 1.0.9 - 2012-04-16
261
+ * Support chained transformations.
262
+
263
+ = Version 1.0.8 - 2012-04-15
264
+ * Support subdomain in CDN according to public id crc32.
265
+
266
+ = Version 1.0.7 - 2012-04-12
267
+ * Issue #2: Adding support to Mongoid and fixing to_json issue.
268
+
269
+ = Version 1.0.6 - 2012-04-11
270
+ * Adding cl_form_tag and fixing old and non rails compatibliltiy issues.
271
+
272
+ = Version 1.0.5 - 2012-04-10
273
+ * Fixing radius parameter.
274
+
275
+ = Version 1.0.4 - 2012-04-04
276
+ * Static assets: progress printing in sync task, whitelist of image extensions.
277
+
278
+ = Version 1.0.3 - 2012-04-02
279
+ * Assets no longer include paths. Allow passing kind in upload and destroy.
280
+ * Better defaults for type which allow working with fetch images.
281
+ * Restore eager format fix.
282
+ * Add radius support.
283
+ * Fix default handling of local images in enhanced image_tag.
284
+
285
+ = Version 1.0.2 - 2012-04-02
286
+ * Support for passing x & y parameters to crop.
287
+ * fetch_image_tag and escaping support.
288
+ * Static file support.
289
+ * Better static sync deletion support. Better image_path integration. Fix access to image_tag with non-relative path.
290
+ * Handle case of file going into trash and back into folder before delete.
291
+ * Readded migrator. Reduce concurrency for old versions of ruby.
292
+
293
+ = Version 1.0.1 - 2012-03-12
294
+ * Replace Array() with safer method.
295
+ * Support passing format as part of the eager transformation.
296
+
297
+ = Version 1.0.0 - 2012-02-22
298
+ * Initial public version.
299
+
300
+
@@ -4,9 +4,28 @@ module CloudinaryHelper
4
4
  alias :original_image_tag :image_tag
5
5
  alias :original_image_path :image_path
6
6
 
7
+ # Stand-in for Rails image_tag helper that accepts various options for transformations.
8
+ #
9
+ # source:: the public ID, possibly with a file type extension. If there is no extension, the
10
+ # :format option is expected to indicate what the extension is. This value can contain
11
+ # the version, or not.
12
+ # options:: Options you would normally pass to image_tag as well as Cloudinary-specific options
13
+ # to control the transformation. Depending on what options are provided, the
14
+ # generated URL may or may not have Cloudinary-specific details in it. For example, if
15
+ # you only specify :width and :height, these values will not be sent to Cloudinary, however
16
+ # if you also specify :crop, they will be.
17
+ #
7
18
  # Examples
8
- # cl_image_tag "israel.png", :width=>100, :height=>100, :alt=>"hello" # W/H are not sent to cloudinary
9
- # cl_image_tag "israel.png", :width=>100, :height=>100, :alt=>"hello", :crop=>:fit # W/H are sent to cloudinary
19
+ # # Image tag sized by the browser, not Cloudinary
20
+ # cl_image_tag "sample.png", :width=>100, :height=>100, :alt=>"hello" # W/H are not sent to Cloudinary
21
+ #
22
+ # # Image tag sized by Cloudinary using the :fit crop strategy
23
+ # cl_image_tag "sample.png", :width=>100, :height=>100, :alt=>"hello", :crop=>:fit # W/H are sent to Cloudinary
24
+ #
25
+ # Get a url for the image with the public id "sample", in :png format.
26
+ # cl_image_tag "sample", format: :png
27
+ #
28
+ # See documentation for more details and options: http://cloudinary.com/documentation/rails_image_manipulation
10
29
  def cl_image_tag(source, options = {})
11
30
  options = options.clone
12
31
  source = cloudinary_url_internal(source, options)
@@ -18,6 +37,7 @@ module CloudinaryHelper
18
37
  original_image_tag(source, options)
19
38
  end
20
39
 
40
+ # Works similarly to cl_image_tag, however just generates the URL of the image
21
41
  def cl_image_path(source, options = {})
22
42
  options = options.clone
23
43
  url = cloudinary_url_internal(source, options)
@@ -150,21 +170,22 @@ module CloudinaryHelper
150
170
  cl_image_upload_tag("#{object_name}[#{method}]", options)
151
171
  end
152
172
 
153
- def cl_image_upload_tag(field, options={})
154
- html_options = options.delete(:html) || {}
155
- cloudinary_upload_url = Cloudinary::Utils.cloudinary_api_url("upload", {:resource_type=>:auto}.merge(options))
156
-
157
- api_key = options[:api_key] || Cloudinary.config.api_key || raise(CloudinaryException, "Must supply api_key")
158
- api_secret = options[:api_secret] || Cloudinary.config.api_secret || raise(CloudinaryException, "Must supply api_secret")
159
-
173
+ def cl_upload_url(options={})
174
+ Cloudinary::Utils.cloudinary_api_url("upload", {:resource_type=>:auto}.merge(options))
175
+ end
176
+
177
+ def cl_upload_tag_params(options={})
160
178
  cloudinary_params = Cloudinary::Uploader.build_upload_params(options)
161
179
  cloudinary_params[:callback] = build_callback_url(options)
162
- cloudinary_params[:signature] = Cloudinary::Utils.api_sign_request(cloudinary_params, api_secret)
163
- cloudinary_params[:api_key] = api_key
180
+ return Cloudinary::Utils.sign_request(cloudinary_params, options).to_json
181
+ end
182
+
183
+ def cl_image_upload_tag(field, options={})
184
+ html_options = options.delete(:html) || {}
164
185
 
165
186
  tag_options = html_options.merge(:type=>"file", :name=>"file",
166
- :"data-url"=>cloudinary_upload_url,
167
- :"data-form-data"=>cloudinary_params.reject{|k, v| v.blank?}.to_json,
187
+ :"data-url"=>cl_upload_url(options),
188
+ :"data-form-data"=>cl_upload_tag_params(options),
168
189
  :"data-cloudinary-field"=>field,
169
190
  :"class" => [html_options[:class], "cloudinary-fileupload"].flatten.compact
170
191
  ).reject{|k,v| v.blank?}
@@ -99,7 +99,7 @@ class Cloudinary::Uploader
99
99
  end
100
100
  end
101
101
 
102
- TEXT_PARAMS = [:public_id, :font_family, :font_size, :font_color, :text_align, :font_weight, :font_style, :background, :opacity, :text_decoration]
102
+ TEXT_PARAMS = [:public_id, :font_family, :font_size, :font_color, :text_align, :font_weight, :font_style, :background, :opacity, :text_decoration, :line_spacing]
103
103
  def self.text(text, options={})
104
104
  call_api("text", options) do
105
105
  params = {:timestamp => Time.now.to_i, :text=>text}
@@ -174,28 +174,30 @@ class Cloudinary::Utils
174
174
  return [cloudinary, "v1_1", cloud_name, resource_type, action].join("/")
175
175
  end
176
176
 
177
- def self.private_download_url(public_id, format, options = {})
177
+ def self.sign_request(params, options={})
178
178
  api_key = options[:api_key] || Cloudinary.config.api_key || raise(CloudinaryException, "Must supply api_key")
179
179
  api_secret = options[:api_secret] || Cloudinary.config.api_secret || raise(CloudinaryException, "Must supply api_secret")
180
- cloudinary_params = {
181
- :timestamp=>Time.now.to_i,
182
- :public_id=>public_id,
183
- :format=>format,
184
- :type=>options[:type],
185
- :attachment=>options[:attachment],
186
- :expires_at=>options[:expires_at] && options[:expires_at].to_i
187
- }.reject{|k, v| v.blank?}
188
- cloudinary_params[:signature] = Cloudinary::Utils.api_sign_request(cloudinary_params, api_secret)
189
- cloudinary_params[:api_key] = api_key
180
+ params = params.reject{|k, v| v.blank?}
181
+ params[:signature] = Cloudinary::Utils.api_sign_request(params, api_secret)
182
+ params[:api_key] = api_key
183
+ params
184
+ end
185
+
186
+ def self.private_download_url(public_id, format, options = {})
187
+ cloudinary_params = sign_request({
188
+ :timestamp=>Time.now.to_i,
189
+ :public_id=>public_id,
190
+ :format=>format,
191
+ :type=>options[:type],
192
+ :attachment=>options[:attachment],
193
+ :expires_at=>options[:expires_at] && options[:expires_at].to_i
194
+ }, options)
195
+
190
196
  return Cloudinary::Utils.cloudinary_api_url("download", options) + "?" + cloudinary_params.to_query
191
197
  end
192
198
 
193
199
  def self.zip_download_url(tag, options = {})
194
- api_key = options[:api_key] || Cloudinary.config.api_key || raise(CloudinaryException, "Must supply api_key")
195
- api_secret = options[:api_secret] || Cloudinary.config.api_secret || raise(CloudinaryException, "Must supply api_secret")
196
- cloudinary_params = {:timestamp=>Time.now.to_i, :tag=>tag, :transformation=>generate_transformation_string(options)}.reject{|k, v| v.blank?}
197
- cloudinary_params[:signature] = Cloudinary::Utils.api_sign_request(cloudinary_params, api_secret)
198
- cloudinary_params[:api_key] = api_key
200
+ cloudinary_params = sign_request({:timestamp=>Time.now.to_i, :tag=>tag, :transformation=>generate_transformation_string(options)}, options)
199
201
  return Cloudinary::Utils.cloudinary_api_url("download_tag.zip", options) + "?" + cloudinary_params.to_query
200
202
  end
201
203
 
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.63"
3
+ VERSION = "1.0.64"
4
4
  end
data/spec/utils_spec.rb CHANGED
@@ -10,7 +10,7 @@ describe Cloudinary::Utils do
10
10
  config.private_cdn = false
11
11
  config.secure = false
12
12
  config.cname = nil
13
- config.cdn_subdomains = false
13
+ config.cdn_subdomain = false
14
14
  config.api_key = "1234"
15
15
  config.api_secret = "1234"
16
16
  end
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.63
4
+ version: 1.0.64
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-08-07 00:00:00.000000000 Z
14
+ date: 2013-10-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -72,6 +72,7 @@ extra_rdoc_files: []
72
72
  files:
73
73
  - .gitignore
74
74
  - .rspec
75
+ - CHANGELOG
75
76
  - Gemfile
76
77
  - README.md
77
78
  - Rakefile