cloudinary 1.23.0 → 1.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eb49ce85c34e632ed20f09a8600694177bf8f82c8490ff5463554c0ab4b3b2e
4
- data.tar.gz: cf2558234f2c9c5dac2de81d2ef2060432a36297a50728f9f01df8997de2805d
3
+ metadata.gz: 4dfd5beeebb091b480f5b9e43dec47fea57c876c62499c8a93356d4b9318051f
4
+ data.tar.gz: 588c68c6ccd722bdfd9d303ca76b34aee2eab30d64cbedfb57d1411160d60ff5
5
5
  SHA512:
6
- metadata.gz: 33147b3fb85715a5472259c06d636a29b45df54eee79d56677b2d2eca846b999e8452e4f6f0661bc9c198ad776d0313f64fb8444075c46fbec789463a2107c22
7
- data.tar.gz: fc33de4ab89ec6bc63be65bad25fcbd0344975e8344ef29ecb365f9dd93c9bf7d6e611f96f8f60cd3d08cc222d308e6b04c27b835d4d9672b1c529821337dee2
6
+ metadata.gz: eb8daa2242a6ad57553aeb65f9bef53440a075518922510e4901eef1c29d952e15c75456a1b4cdfbc35aaced3ac3adcbca18f3b307e72521bebad48138139095
7
+ data.tar.gz: 67fb1cb9c9e299fd0a914b49a7083afdd076b064690afc25faa4250a04bed0a1e9077cac72cb102fe70c8da23399e1e62066395c53ba2c34d9e1e5d6b8dfa9fa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ 1.24.0 / 2022-12-06
2
+ ==================
3
+
4
+ New functionality and features
5
+ ------------------------------
6
+
7
+ * Add support for `resources_by_asset_folder` Admin API
8
+ * Add support for `asset_folder`, `display_name` and `unique_display_name` parameters
9
+ * Add support for `use_asset_folder_as_public_id_prefix` parameter
10
+ * Add support for `metadata` in `update` Admin API
11
+ * Add support for `clear_invalid` metadata parameter
12
+
13
+ Other Changes
14
+ -------------
15
+
16
+ * Fix Active Storage public id of the raw asset handling
17
+ * Fix Active Storage resource type for direct upload
18
+ * Fix CarrierWave identifier obtainment
19
+
1
20
  1.23.0 / 2022-04-05
2
21
  ==================
3
22
 
@@ -56,8 +56,8 @@ module ActiveStorage
56
56
  def url(key, filename: nil, content_type: '', **options)
57
57
  instrument :url, key: key do |payload|
58
58
  url = Cloudinary::Utils.cloudinary_url(
59
- public_id(key),
60
- resource_type: resource_type(nil, key),
59
+ full_public_id_internal(key),
60
+ resource_type: resource_type(nil, key, content_type),
61
61
  format: ext_for_file(key, filename, content_type),
62
62
  **@options.merge(options.symbolize_keys)
63
63
  )
@@ -70,7 +70,8 @@ module ActiveStorage
70
70
 
71
71
  def url_for_direct_upload(key, **options)
72
72
  instrument :url, key: key do |payload|
73
- options = {:resource_type => resource_type(nil, key)}.merge(@options.merge(options.symbolize_keys))
73
+ options = @options.merge(options.symbolize_keys)
74
+ options[:resource_type] ||= resource_type(nil, key, options[:content_type])
74
75
  options[:public_id] = public_id_internal(key)
75
76
  # Provide file format for raw files, since js client does not include original file name.
76
77
  #
@@ -164,10 +165,23 @@ module ActiveStorage
164
165
 
165
166
  end
166
167
 
167
- def public_id(key)
168
- return key unless @options[:folder]
168
+ # Returns the public id of the asset.
169
+ #
170
+ # Public id includes both folder(defined globally in the configuration) and the active storage key.
171
+ # For raw files it also includes the file extension, since that's how Cloudinary stores raw files.
172
+ #
173
+ # @param [ActiveStorage::BlobKey] key The blob key with attributes.
174
+ # @param [ActiveStorage::Filename] filename The original filename.
175
+ # @param [string] content_type The content type of the file.
176
+ #
177
+ # @return [string] The public id of the asset.
178
+ def public_id(key, filename = nil, content_type = '')
179
+ public_id = key
180
+ if resource_type(nil, key) == 'raw'
181
+ public_id = [key, ext_for_file(key, filename, content_type)].reject(&:blank?).join('.')
182
+ end
169
183
 
170
- File.join(@options.fetch(:folder), public_id_internal(key))
184
+ full_public_id_internal(public_id)
171
185
  end
172
186
 
173
187
  private
@@ -212,6 +226,15 @@ module ActiveStorage
212
226
  @formats[content_type]
213
227
  end
214
228
 
229
+ # Returns the full public id including folder.
230
+ def full_public_id_internal(key)
231
+ public_id = public_id_internal(key)
232
+
233
+ return public_id unless @options[:folder]
234
+
235
+ File.join(@options.fetch(:folder), public_id)
236
+ end
237
+
215
238
  def public_id_internal(key)
216
239
  # TODO: Allow custom manipulation of key to obscure how we store in Cloudinary
217
240
  key
@@ -240,9 +263,11 @@ module ActiveStorage
240
263
  end
241
264
  end
242
265
 
243
- def resource_type(io, key = "")
244
- options = key.respond_to?(:attributes) ? key.attributes : {}
245
- content_type = options[:content_type] || (io.nil? ? '' : Marcel::MimeType.for(io))
266
+ def resource_type(io, key = "", content_type = "")
267
+ if content_type.blank?
268
+ options = key.respond_to?(:attributes) ? key.attributes : {}
269
+ content_type = options[:content_type] || (io.nil? ? '' : Marcel::MimeType.for(io))
270
+ end
246
271
  content_type_to_resource_type(content_type)
247
272
  end
248
273
  end
@@ -189,6 +189,24 @@ class Cloudinary::Api
189
189
  call_api(:get, uri, params, options)
190
190
  end
191
191
 
192
+ # Returns all assets stored directly in a specified asset folder, regardless of the public ID paths of those assets.
193
+ #
194
+ # @param [String] asset_folder The requested asset folder.
195
+ # @param [Hash] options The optional parameters. See the
196
+ # <a href=https://cloudinary.com/documentation/dynamic_folders#new_admin_api_endpoints target="_blank"> Admin API</a> documentation.
197
+ #
198
+ # @return [Cloudinary::Api::Response]
199
+ #
200
+ # @raise [Cloudinary::Api::Error]
201
+ #
202
+ # @see https://cloudinary.com/documentation/dynamic_folders#new_admin_api_endpoints
203
+ def self.resources_by_asset_folder(asset_folder, options={})
204
+ uri = "resources/by_asset_folder"
205
+ params = only(options, :next_cursor, :max_results, :tags, :context, :moderations, :direction, :key, :value, :metadata)
206
+ params[:asset_folder] = asset_folder
207
+ call_api(:get, uri, params, options)
208
+ end
209
+
192
210
  # Returns the details of the specified asset and all its derived assets.
193
211
  #
194
212
  # Note that if you only need details about the original asset,
@@ -250,20 +268,25 @@ class Cloudinary::Api
250
268
  uri = "resources/#{resource_type}/#{type}/#{public_id}"
251
269
  update_options = {
252
270
  :access_control => Cloudinary::Utils.json_array_param(options[:access_control]),
271
+ :asset_folder => options[:asset_folder],
253
272
  :auto_tagging => options[:auto_tagging] && options[:auto_tagging].to_f,
254
273
  :background_removal => options[:background_removal],
255
274
  :categorization => options[:categorization],
256
275
  :context => Cloudinary::Utils.encode_context(options[:context]),
257
276
  :custom_coordinates => Cloudinary::Utils.encode_double_array(options[:custom_coordinates]),
258
277
  :detection => options[:detection],
278
+ :display_name => options[:display_name],
259
279
  :face_coordinates => Cloudinary::Utils.encode_double_array(options[:face_coordinates]),
280
+ :metadata => Cloudinary::Utils.encode_context(options[:metadata]),
260
281
  :moderation_status => options[:moderation_status],
261
282
  :notification_url => options[:notification_url],
262
283
  :quality_override => options[:quality_override],
263
284
  :ocr => options[:ocr],
264
285
  :raw_convert => options[:raw_convert],
265
286
  :similarity_search => options[:similarity_search],
266
- :tags => options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(",")
287
+ :tags => options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(","),
288
+ :clear_invalid => Cloudinary::Utils.as_safe_bool(options[:clear_invalid]),
289
+ :unique_display_name=> options[:unique_display_name]
267
290
  }
268
291
  call_api(:post, uri, update_options, options)
269
292
  end
@@ -163,7 +163,7 @@ module Cloudinary::CarrierWave
163
163
  super
164
164
 
165
165
  column = model.send(:_mounter, mounted_as).send(:serialization_column)
166
- identifier = model.send(:attribute, column)
166
+ identifier = model.read_attribute(column)
167
167
  retrieve_from_store!(identifier) unless identifier.nil?
168
168
  end
169
169
  end
@@ -18,60 +18,62 @@ class Cloudinary::Uploader
18
18
  options.keys.each { |key| options[key.to_sym] = options.delete(key) if key.is_a?(String) }
19
19
 
20
20
  params = {
21
- :access_control => Cloudinary::Utils.json_array_param(options[:access_control]),
22
- :access_mode => options[:access_mode],
23
- :allowed_formats => Cloudinary::Utils.build_array(options[:allowed_formats]).join(","),
24
- :asset_folder => options[:asset_folder],
25
- :async => Cloudinary::Utils.as_safe_bool(options[:async]),
26
- :auto_tagging => options[:auto_tagging] && options[:auto_tagging].to_f,
27
- :background_removal => options[:background_removal],
28
- :backup => Cloudinary::Utils.as_safe_bool(options[:backup]),
29
- :callback => options[:callback],
30
- :categorization => options[:categorization],
31
- :cinemagraph_analysis => Cloudinary::Utils.as_safe_bool(options[:cinemagraph_analysis]),
32
- :colors => Cloudinary::Utils.as_safe_bool(options[:colors]),
33
- :context => Cloudinary::Utils.encode_context(options[:context]),
34
- :custom_coordinates => Cloudinary::Utils.encode_double_array(options[:custom_coordinates]),
35
- :detection => options[:detection],
36
- :discard_original_filename => Cloudinary::Utils.as_safe_bool(options[:discard_original_filename]),
37
- :display_name => options[:display_name],
38
- :eager => Cloudinary::Utils.build_eager(options[:eager]),
39
- :eager_async => Cloudinary::Utils.as_safe_bool(options[:eager_async]),
40
- :eager_notification_url => options[:eager_notification_url],
41
- :exif => Cloudinary::Utils.as_safe_bool(options[:exif]),
42
- :eval => options[:eval],
43
- :face_coordinates => Cloudinary::Utils.encode_double_array(options[:face_coordinates]),
44
- :faces => Cloudinary::Utils.as_safe_bool(options[:faces]),
45
- :folder => options[:folder],
46
- :format => options[:format],
47
- :filename_override => options[:filename_override],
48
- :headers => build_custom_headers(options[:headers]),
49
- :image_metadata => Cloudinary::Utils.as_safe_bool(options[:image_metadata]),
50
- :invalidate => Cloudinary::Utils.as_safe_bool(options[:invalidate]),
51
- :moderation => options[:moderation],
52
- :notification_url => options[:notification_url],
53
- :ocr => options[:ocr],
54
- :overwrite => Cloudinary::Utils.as_safe_bool(options[:overwrite]),
55
- :phash => Cloudinary::Utils.as_safe_bool(options[:phash]),
56
- :proxy => options[:proxy],
57
- :public_id => options[:public_id],
58
- :public_id_prefix => options[:public_id_prefix],
59
- :quality_analysis => Cloudinary::Utils.as_safe_bool(options[:quality_analysis]),
60
- :quality_override => options[:quality_override],
61
- :raw_convert => options[:raw_convert],
62
- :responsive_breakpoints => Cloudinary::Utils.generate_responsive_breakpoints_string(options[:responsive_breakpoints]),
63
- :return_delete_token => Cloudinary::Utils.as_safe_bool(options[:return_delete_token]),
64
- :similarity_search => options[:similarity_search],
65
- :tags => options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(","),
66
- :timestamp => (options[:timestamp] || Time.now.to_i),
67
- :transformation => Cloudinary::Utils.generate_transformation_string(options.clone),
68
- :type => options[:type],
69
- :unique_filename => Cloudinary::Utils.as_safe_bool(options[:unique_filename]),
70
- :upload_preset => options[:upload_preset],
71
- :use_filename => Cloudinary::Utils.as_safe_bool(options[:use_filename]),
72
- :use_filename_as_display_name => Cloudinary::Utils.as_safe_bool(options[:use_filename_as_display_name]),
73
- :accessibility_analysis => Cloudinary::Utils.as_safe_bool(options[:accessibility_analysis]),
74
- :metadata => Cloudinary::Utils.encode_context(options[:metadata])
21
+ :access_control => Cloudinary::Utils.json_array_param(options[:access_control]),
22
+ :access_mode => options[:access_mode],
23
+ :allowed_formats => Cloudinary::Utils.build_array(options[:allowed_formats]).join(","),
24
+ :asset_folder => options[:asset_folder],
25
+ :async => Cloudinary::Utils.as_safe_bool(options[:async]),
26
+ :auto_tagging => options[:auto_tagging] && options[:auto_tagging].to_f,
27
+ :background_removal => options[:background_removal],
28
+ :backup => Cloudinary::Utils.as_safe_bool(options[:backup]),
29
+ :callback => options[:callback],
30
+ :categorization => options[:categorization],
31
+ :cinemagraph_analysis => Cloudinary::Utils.as_safe_bool(options[:cinemagraph_analysis]),
32
+ :colors => Cloudinary::Utils.as_safe_bool(options[:colors]),
33
+ :context => Cloudinary::Utils.encode_context(options[:context]),
34
+ :custom_coordinates => Cloudinary::Utils.encode_double_array(options[:custom_coordinates]),
35
+ :detection => options[:detection],
36
+ :discard_original_filename => Cloudinary::Utils.as_safe_bool(options[:discard_original_filename]),
37
+ :display_name => options[:display_name],
38
+ :eager => Cloudinary::Utils.build_eager(options[:eager]),
39
+ :eager_async => Cloudinary::Utils.as_safe_bool(options[:eager_async]),
40
+ :eager_notification_url => options[:eager_notification_url],
41
+ :exif => Cloudinary::Utils.as_safe_bool(options[:exif]),
42
+ :eval => options[:eval],
43
+ :face_coordinates => Cloudinary::Utils.encode_double_array(options[:face_coordinates]),
44
+ :faces => Cloudinary::Utils.as_safe_bool(options[:faces]),
45
+ :folder => options[:folder],
46
+ :format => options[:format],
47
+ :filename_override => options[:filename_override],
48
+ :headers => build_custom_headers(options[:headers]),
49
+ :image_metadata => Cloudinary::Utils.as_safe_bool(options[:image_metadata]),
50
+ :invalidate => Cloudinary::Utils.as_safe_bool(options[:invalidate]),
51
+ :moderation => options[:moderation],
52
+ :notification_url => options[:notification_url],
53
+ :ocr => options[:ocr],
54
+ :overwrite => Cloudinary::Utils.as_safe_bool(options[:overwrite]),
55
+ :phash => Cloudinary::Utils.as_safe_bool(options[:phash]),
56
+ :proxy => options[:proxy],
57
+ :public_id => options[:public_id],
58
+ :public_id_prefix => options[:public_id_prefix],
59
+ :quality_analysis => Cloudinary::Utils.as_safe_bool(options[:quality_analysis]),
60
+ :quality_override => options[:quality_override],
61
+ :raw_convert => options[:raw_convert],
62
+ :responsive_breakpoints => Cloudinary::Utils.generate_responsive_breakpoints_string(options[:responsive_breakpoints]),
63
+ :return_delete_token => Cloudinary::Utils.as_safe_bool(options[:return_delete_token]),
64
+ :similarity_search => options[:similarity_search],
65
+ :tags => options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(","),
66
+ :timestamp => (options[:timestamp] || Time.now.to_i),
67
+ :transformation => Cloudinary::Utils.generate_transformation_string(options.clone),
68
+ :type => options[:type],
69
+ :unique_filename => Cloudinary::Utils.as_safe_bool(options[:unique_filename]),
70
+ :upload_preset => options[:upload_preset],
71
+ :use_filename => Cloudinary::Utils.as_safe_bool(options[:use_filename]),
72
+ :use_filename_as_display_name => Cloudinary::Utils.as_safe_bool(options[:use_filename_as_display_name]),
73
+ :use_asset_folder_as_public_id_prefix => Cloudinary::Utils.as_safe_bool(options[:use_asset_folder_as_public_id_prefix]),
74
+ :unique_display_name => Cloudinary::Utils.as_safe_bool(options[:unique_display_name]),
75
+ :accessibility_analysis => Cloudinary::Utils.as_safe_bool(options[:accessibility_analysis]),
76
+ :metadata => Cloudinary::Utils.encode_context(options[:metadata])
75
77
  }
76
78
  params
77
79
  end
@@ -325,7 +327,8 @@ class Cloudinary::Uploader
325
327
  timestamp: (options[:timestamp] || Time.now.to_i),
326
328
  type: options[:type],
327
329
  public_ids: Cloudinary::Utils.build_array(public_ids),
328
- metadata: Cloudinary::Utils.encode_context(metadata)
330
+ metadata: Cloudinary::Utils.encode_context(metadata),
331
+ clear_invalid: Cloudinary::Utils.as_safe_bool(options[:clear_invalid])
329
332
  }
330
333
  end
331
334
  end
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.23.0"
3
+ VERSION = "1.24.0"
4
4
  end
@@ -1,2 +1 @@
1
1
  !function(t){"use strict";var e=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,o=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),n=o&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),r=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,a=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,i=(o||r)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,i,l,u,c,f,b,d,B;if(!(e=t.match(a)))throw new Error("invalid data URI");for(i=e[2]?e[1]:"text/plain"+(e[3]||";charset=US-ASCII"),l=!!e[4],u=t.slice(e[0].length),c=l?atob(u):decodeURIComponent(u),f=new ArrayBuffer(c.length),b=new Uint8Array(f),d=0;d<c.length;d+=1)b[d]=c.charCodeAt(d);return o?new Blob([n?b:f],{type:i}):((B=new r).append(f),B.getBlob(i))};t.HTMLCanvasElement&&!e.toBlob&&(e.mozGetAsFile?e.toBlob=function(t,o,n){var r=this;setTimeout(function(){t(n&&e.toDataURL&&i?i(r.toDataURL(o,n)):r.mozGetAsFile("blob",o))})}:e.toDataURL&&i&&(e.toBlob=function(t,e,o){var n=this;setTimeout(function(){t(i(n.toDataURL(e,o)))})})),"function"==typeof define&&define.amd?define(function(){return i}):"object"==typeof module&&module.exports?module.exports=i:t.dataURLtoBlob=i}(window);
2
- //# sourceMappingURL=canvas-to-blob.min.js.map
@@ -1093,11 +1093,11 @@ var slice = [].slice,
1093
1093
  *
1094
1094
  * If the parameter is an object,
1095
1095
  * @param {(string|Object)} param - the video codec as either a String or a Hash
1096
- * @return {string} the video codec string in the format codec:profile:level
1096
+ * @return {string} the video codec string in the format codec:profile:level:b_frames
1097
1097
  * @example
1098
- * vc_[ :profile : [level]]
1098
+ * vc_[ :profile : [level : [b_frames]]]
1099
1099
  * or
1100
- { codec: 'h264', profile: 'basic', level: '3.1' }
1100
+ { codec: 'h264', profile: 'basic', level: '3.1', b_frames: false }
1101
1101
  * @ignore
1102
1102
  */
1103
1103
 
@@ -1112,6 +1112,9 @@ var slice = [].slice,
1112
1112
  video += ":" + param['profile'];
1113
1113
  if ('level' in param) {
1114
1114
  video += ":" + param['level'];
1115
+ if ('b_frames' in param && param['b_frames'] === false) {
1116
+ video += ":bframes_no";
1117
+ }
1115
1118
  }
1116
1119
  }
1117
1120
  }
@@ -1,2 +1 @@
1
1
  !function(e){"use strict";function t(e,i,a){var o,n=document.createElement("img");return n.onerror=function(o){return t.onerror(n,o,e,i,a)},n.onload=function(o){return t.onload(n,o,e,i,a)},"string"==typeof e?(t.fetchBlob(e,function(i){i?(e=i,o=t.createObjectURL(e)):(o=e,a&&a.crossOrigin&&(n.crossOrigin=a.crossOrigin)),n.src=o},a),n):t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e)?(o=n._objectURL=t.createObjectURL(e))?(n.src=o,n):t.readFile(e,function(e){var t=e.target;t&&t.result?n.src=t.result:i&&i(e)}):void 0}function i(e,i){!e._objectURL||i&&i.noRevoke||(t.revokeObjectURL(e._objectURL),delete e._objectURL)}var a=e.createObjectURL&&e||e.URL&&URL.revokeObjectURL&&URL||e.webkitURL&&webkitURL;t.fetchBlob=function(e,t,i){t()},t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.transform=function(e,t,i,a,o){i(e,o)},t.onerror=function(e,t,a,o,n){i(e,n),o&&o.call(e,t)},t.onload=function(e,a,o,n,r){i(e,r),n&&t.transform(e,r,n,o,{})},t.createObjectURL=function(e){return!!a&&a.createObjectURL(e)},t.revokeObjectURL=function(e){return!!a&&a.revokeObjectURL(e)},t.readFile=function(t,i,a){if(e.FileReader){var o=new FileReader;if(o.onload=o.onerror=i,a=a||"readAsDataURL",o[a])return o[a](t),o}return!1},"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:e.loadImage=t}("undefined"!=typeof window&&window||this),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t=e.transform;e.transform=function(i,a,o,n,r){t.call(e,e.scale(i,a,r),a,o,n,r)},e.transformCoordinates=function(){},e.getTransformedOptions=function(e,t){var i,a,o,n,r=t.aspectRatio;if(!r)return t;i={};for(a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);return i.crop=!0,o=e.naturalWidth||e.width,n=e.naturalHeight||e.height,o/n>r?(i.maxWidth=n*r,i.maxHeight=n):(i.maxWidth=o,i.maxHeight=o/r),i},e.renderImageToCanvas=function(e,t,i,a,o,n,r,s,l,c){return e.getContext("2d").drawImage(t,i,a,o,n,r,s,l,c),e},e.hasCanvasOption=function(e){return e.canvas||e.crop||!!e.aspectRatio},e.scale=function(t,i,a){function o(){var e=Math.max((l||I)/I,(c||v)/v);e>1&&(I*=e,v*=e)}function n(){var e=Math.min((r||I)/I,(s||v)/v);e<1&&(I*=e,v*=e)}i=i||{};var r,s,l,c,d,u,f,g,p,m,h,S=document.createElement("canvas"),b=t.getContext||e.hasCanvasOption(i)&&S.getContext,y=t.naturalWidth||t.width,x=t.naturalHeight||t.height,I=y,v=x;if(b&&(f=(i=e.getTransformedOptions(t,i,a)).left||0,g=i.top||0,i.sourceWidth?(d=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(f=y-d-i.right)):d=y-f-(i.right||0),i.sourceHeight?(u=i.sourceHeight,void 0!==i.bottom&&void 0===i.top&&(g=x-u-i.bottom)):u=x-g-(i.bottom||0),I=d,v=u),r=i.maxWidth,s=i.maxHeight,l=i.minWidth,c=i.minHeight,b&&r&&s&&i.crop?(I=r,v=s,(h=d/u-r/s)<0?(u=s*d/r,void 0===i.top&&void 0===i.bottom&&(g=(x-u)/2)):h>0&&(d=r*u/s,void 0===i.left&&void 0===i.right&&(f=(y-d)/2))):((i.contain||i.cover)&&(l=r=r||l,c=s=s||c),i.cover?(n(),o()):(o(),n())),b){if((p=i.pixelRatio)>1&&(S.style.width=I+"px",S.style.height=v+"px",I*=p,v*=p,S.getContext("2d").scale(p,p)),(m=i.downsamplingRatio)>0&&m<1&&I<d&&v<u)for(;d*m>I;)S.width=d*m,S.height=u*m,e.renderImageToCanvas(S,t,f,g,d,u,0,0,S.width,S.height),f=0,g=0,d=S.width,u=S.height,(t=document.createElement("canvas")).width=d,t.height=u,e.renderImageToCanvas(t,S,0,0,d,u,0,0,d,u);return S.width=I,S.height=v,e.transformCoordinates(S,i),e.renderImageToCanvas(S,t,f,g,d,u,0,0,I,v)}return t.width=I,t.height=v,t}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t="undefined"!=typeof Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);e.blobSlice=t&&function(){return(this.slice||this.webkitSlice||this.mozSlice).apply(this,arguments)},e.metaDataParsers={jpeg:{65505:[],65517:[]}},e.parseMetaData=function(t,i,a,o){a=a||{},o=o||{};var n=this,r=a.maxMetaDataSize||262144;!!("undefined"!=typeof DataView&&t&&t.size>=12&&"image/jpeg"===t.type&&e.blobSlice)&&e.readFile(e.blobSlice.call(t,0,r),function(t){if(t.target.error)return console.log(t.target.error),void i(o);var r,s,l,c,d=t.target.result,u=new DataView(d),f=2,g=u.byteLength-4,p=f;if(65496===u.getUint16(0)){for(;f<g&&((r=u.getUint16(f))>=65504&&r<=65519||65534===r);){if(s=u.getUint16(f+2)+2,f+s>u.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(l=e.metaDataParsers.jpeg[r])for(c=0;c<l.length;c+=1)l[c].call(n,u,f,s,o,a);p=f+=s}!a.disableImageHead&&p>6&&(d.slice?o.imageHead=d.slice(0,p):o.imageHead=new Uint8Array(d).subarray(0,p))}else console.log("Invalid JPEG file: Missing JPEG marker.");i(o)},"readAsArrayBuffer")||i(o)},e.hasMetaOption=function(e){return e&&e.meta};var i=e.transform;e.transform=function(t,a,o,n,r){e.hasMetaOption(a)?e.parseMetaData(n,function(r){i.call(e,t,a,o,n,r)},a,r):i.apply(e,arguments)}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";"undefined"!=typeof fetch&&"undefined"!=typeof Request&&(e.fetchBlob=function(t,i,a){if(e.hasMetaOption(a))return fetch(new Request(t,a)).then(function(e){return e.blob()}).then(i).catch(function(e){console.log(e),i()});i()})}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-scale","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-scale"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";var t=e.hasCanvasOption,i=e.hasMetaOption,a=e.transformCoordinates,o=e.getTransformedOptions;e.hasCanvasOption=function(i){return!!i.orientation||t.call(e,i)},e.hasMetaOption=function(t){return t&&!0===t.orientation||i.call(e,t)},e.transformCoordinates=function(t,i){a.call(e,t,i);var o=t.getContext("2d"),n=t.width,r=t.height,s=t.style.width,l=t.style.height,c=i.orientation;if(c&&!(c>8))switch(c>4&&(t.width=r,t.height=n,t.style.width=l,t.style.height=s),c){case 2:o.translate(n,0),o.scale(-1,1);break;case 3:o.translate(n,r),o.rotate(Math.PI);break;case 4:o.translate(0,r),o.scale(1,-1);break;case 5:o.rotate(.5*Math.PI),o.scale(1,-1);break;case 6:o.rotate(.5*Math.PI),o.translate(0,-r);break;case 7:o.rotate(.5*Math.PI),o.translate(n,-r),o.scale(-1,1);break;case 8:o.rotate(-.5*Math.PI),o.translate(-n,0)}},e.getTransformedOptions=function(t,i,a){var n,r,s=o.call(e,t,i),l=s.orientation;if(!0===l&&a&&a.exif&&(l=a.exif.get("Orientation")),!l||l>8||1===l)return s;n={};for(r in s)s.hasOwnProperty(r)&&(n[r]=s[r]);switch(n.orientation=l,l){case 2:n.left=s.right,n.right=s.left;break;case 3:n.left=s.right,n.top=s.bottom,n.right=s.left,n.bottom=s.top;break;case 4:n.top=s.bottom,n.bottom=s.top;break;case 5:n.left=s.top,n.top=s.left,n.right=s.bottom,n.bottom=s.right;break;case 6:n.left=s.top,n.top=s.right,n.right=s.bottom,n.bottom=s.left;break;case 7:n.left=s.bottom,n.top=s.right,n.right=s.top,n.bottom=s.left;break;case 8:n.left=s.bottom,n.top=s.left,n.right=s.top,n.bottom=s.right}return n.orientation>4&&(n.maxWidth=s.maxHeight,n.maxHeight=s.maxWidth,n.minWidth=s.minHeight,n.minHeight=s.minWidth,n.sourceWidth=s.sourceHeight,n.sourceHeight=s.sourceWidth),n}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";e.ExifMap=function(){return this},e.ExifMap.prototype.map={Orientation:274},e.ExifMap.prototype.get=function(e){return this[e]||this[this.map[e]]},e.getExifThumbnail=function(t,i,a){if(a&&!(i+a>t.byteLength))return e.createObjectURL(new Blob([t.buffer.slice(i,i+a)]));console.log("Invalid Exif data: Invalid thumbnail data.")},e.exifTagTypes={1:{getValue:function(e,t){return e.getUint8(t)},size:1},2:{getValue:function(e,t){return String.fromCharCode(e.getUint8(t))},size:1,ascii:!0},3:{getValue:function(e,t,i){return e.getUint16(t,i)},size:2},4:{getValue:function(e,t,i){return e.getUint32(t,i)},size:4},5:{getValue:function(e,t,i){return e.getUint32(t,i)/e.getUint32(t+4,i)},size:8},9:{getValue:function(e,t,i){return e.getInt32(t,i)},size:4},10:{getValue:function(e,t,i){return e.getInt32(t,i)/e.getInt32(t+4,i)},size:8}},e.exifTagTypes[7]=e.exifTagTypes[1],e.getExifValue=function(t,i,a,o,n,r){var s,l,c,d,u,f,g=e.exifTagTypes[o];if(g){if(s=g.size*n,!((l=s>4?i+t.getUint32(a+8,r):a+8)+s>t.byteLength)){if(1===n)return g.getValue(t,l,r);for(c=[],d=0;d<n;d+=1)c[d]=g.getValue(t,l+d*g.size,r);if(g.ascii){for(u="",d=0;d<c.length&&"\0"!==(f=c[d]);d+=1)u+=f;return u}return c}console.log("Invalid Exif data: Invalid data offset.")}else console.log("Invalid Exif data: Invalid tag type.")},e.parseExifTag=function(t,i,a,o,n){var r=t.getUint16(a,o);n.exif[r]=e.getExifValue(t,i,a,t.getUint16(a+2,o),t.getUint32(a+4,o),o)},e.parseExifTags=function(e,t,i,a,o){var n,r,s;if(i+6>e.byteLength)console.log("Invalid Exif data: Invalid directory offset.");else{if(n=e.getUint16(i,a),!((r=i+2+12*n)+4>e.byteLength)){for(s=0;s<n;s+=1)this.parseExifTag(e,t,i+2+12*s,a,o);return e.getUint32(r,a)}console.log("Invalid Exif data: Invalid directory size.")}},e.parseExifData=function(t,i,a,o,n){if(!n.disableExif){var r,s,l,c=i+10;if(1165519206===t.getUint32(i+4))if(c+8>t.byteLength)console.log("Invalid Exif data: Invalid segment size.");else if(0===t.getUint16(i+8)){switch(t.getUint16(c)){case 18761:r=!0;break;case 19789:r=!1;break;default:return void console.log("Invalid Exif data: Invalid byte alignment marker.")}42===t.getUint16(c+2,r)?(s=t.getUint32(c+4,r),o.exif=new e.ExifMap,(s=e.parseExifTags(t,c,c+s,r,o))&&!n.disableExifThumbnail&&(l={exif:{}},s=e.parseExifTags(t,c,c+s,r,l),l.exif[513]&&(o.exif.Thumbnail=e.getExifThumbnail(t,c+l.exif[513],l.exif[514]))),o.exif[34665]&&!n.disableExifSub&&e.parseExifTags(t,c,c+o.exif[34665],r,o),o.exif[34853]&&!n.disableExifGps&&e.parseExifTags(t,c,c+o.exif[34853],r,o)):console.log("Invalid Exif data: Missing TIFF marker.")}else console.log("Invalid Exif data: Missing byte alignment offset.")}},e.metaDataParsers.jpeg[65505].push(e.parseExifData)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-exif"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-exif")):e(window.loadImage)}(function(e){"use strict";e.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},e.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Undefined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},e.ExifMap.prototype.getText=function(e){var t=this.get(e);switch(e){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":case"Orientation":return this.stringValues[e][t];case"ExifVersion":case"FlashpixVersion":if(!t)return;return String.fromCharCode(t[0],t[1],t[2],t[3]);case"ComponentsConfiguration":if(!t)return;return this.stringValues[e][t[0]]+this.stringValues[e][t[1]]+this.stringValues[e][t[2]]+this.stringValues[e][t[3]];case"GPSVersionID":if(!t)return;return t[0]+"."+t[1]+"."+t[2]+"."+t[3]}return String(t)},function(e){var t,i=e.tags,a=e.map;for(t in i)i.hasOwnProperty(t)&&(a[i[t]]=t)}(e.ExifMap.prototype),e.ExifMap.prototype.getAll=function(){var e,t,i={};for(e in this)this.hasOwnProperty(e)&&(t=this.tags[e])&&(i[t]=this.getText(t));return i}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";e.IptcMap=function(){return this},e.IptcMap.prototype.map={ObjectName:5},e.IptcMap.prototype.get=function(e){return this[e]||this[this.map[e]]},e.parseIptcTags=function(e,t,i,a){for(var o,n,r=t;r<t+i;)28===e.getUint8(r)&&2===e.getUint8(r+1)&&(n=e.getUint8(r+2))in a.iptc.tags&&(o=function(e,t,i){for(var a="",o=t;o<t+i;o++)a+=String.fromCharCode(e.getUint8(o));return a}(e,r+5,e.getInt16(r+3)),a.iptc.hasOwnProperty(n)?a.iptc[n]instanceof Array?a.iptc[n].push(o):a.iptc[n]=[a.iptc[n],o]:a.iptc[n]=o),r++},e.parseIptcData=function(t,i,a,o,n){if(!n.disableIptc){for(var r=i+a;i+8<r;){if(function(e,t){return 943868237===e.getUint32(t)&&1028===e.getUint16(t+4)}(t,i)){var s=t.getUint8(i+7);s%2!=0&&(s+=1),0===s&&(s=4);var l=i+8+s;if(l>r){console.log("Invalid IPTC data: Invalid segment offset.");break}var c=t.getUint16(i+6+s);if(i+c>r){console.log("Invalid IPTC data: Invalid segment size.");break}return o.iptc=new e.IptcMap,e.parseIptcTags(t,l,c,o)}i++}console.log("No IPTC data at this offset - could be XMP")}},e.metaDataParsers.jpeg[65517].push(e.parseIptcData)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-iptc"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-iptc")):e(window.loadImage)}(function(e){"use strict";e.IptcMap.prototype.tags={3:"ObjectType",4:"ObjectAttribute",5:"ObjectName",7:"EditStatus",8:"EditorialUpdate",10:"Urgency",12:"SubjectRef",15:"Category",20:"SupplCategory",22:"FixtureID",25:"Keywords",26:"ContentLocCode",27:"ContentLocName",30:"ReleaseDate",35:"ReleaseTime",37:"ExpirationDate",38:"ExpirationTime",40:"SpecialInstructions",42:"ActionAdvised",45:"RefService",47:"RefDate",50:"RefNumber",55:"DateCreated",60:"TimeCreated",62:"DigitalCreationDate",63:"DigitalCreationTime",65:"OriginatingProgram",70:"ProgramVersion",75:"ObjectCycle",80:"Byline",85:"BylineTitle",90:"City",92:"Sublocation",95:"State",100:"CountryCode",101:"CountryName",103:"OrigTransRef",105:"Headline",110:"Credit",115:"Source",116:"CopyrightNotice",118:"Contact",120:"Caption",122:"WriterEditor",130:"ImageType",131:"ImageOrientation",135:"LanguageID"},e.IptcMap.prototype.getText=function(e){var t=this.get(e);return String(t)},function(e){var t,i=e.tags,a=e.map||{};for(t in i)i.hasOwnProperty(t)&&(a[i[t]]=t)}(e.IptcMap.prototype),e.IptcMap.prototype.getAll=function(){var e,t,i={};for(e in this)this.hasOwnProperty(e)&&(t=this.tags[e])&&(i[t]=this.getText(t));return i}});
2
- //# sourceMappingURL=load-image.all.min.js.map
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.23.0
4
+ version: 1.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadav Soferman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-04-05 00:00:00.000000000 Z
13
+ date: 2022-12-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws_cf_signer