cloudinary 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/cloudinary/carrier_wave.rb +40 -37
- data/lib/cloudinary/utils.rb +2 -2
- data/lib/cloudinary/version.rb +1 -1
- data/spec/auth_token_spec.rb +2 -2
- data/spec/cloudinary_helper_spec.rb +2 -2
- data/spec/uploader_spec.rb +0 -4
- data/spec/utils_spec.rb +16 -0
- data/vendor/assets/javascripts/cloudinary/canvas-to-blob.min.js +1 -1
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +311 -101
- data/vendor/assets/javascripts/cloudinary/jquery.fileupload-image.js +3 -1
- data/vendor/assets/javascripts/cloudinary/jquery.fileupload-process.js +5 -2
- data/vendor/assets/javascripts/cloudinary/jquery.fileupload-validate.js +5 -2
- data/vendor/assets/javascripts/cloudinary/jquery.fileupload.js +11 -6
- data/vendor/assets/javascripts/cloudinary/jquery.iframe-transport.js +11 -4
- data/vendor/assets/javascripts/cloudinary/load-image.all.min.js +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fd535c0bc5341c9ba6dc09a32f24b59886cbee9
|
4
|
+
data.tar.gz: 410e9129e4990f62ebbeeb2fe20cdf340db91277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 808f9c7439fb2c6e0f2b3b9fba6bb92d96d08b9e3436723a22cdfa974bf1c4b6d64a3c1ea43a73d0fb46c09f20355c42c1922723535ba2246f10003776d7bc30
|
7
|
+
data.tar.gz: f04de4f7cd51a3e25b1f0b48153774f62ec0644a532eb48fc2db8b373a6e962507cce4db6025f17a2e8095bf0828fb992e53c4c2dd43068155938480bdb80ba8
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
1.8.3 / 2018-02-04
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Suppress warnings in tests
|
6
|
+
* Support symbols in `context`
|
7
|
+
* Remove `auto_tagging` failure test
|
8
|
+
* Fix fully_unescape
|
9
|
+
* Whitespace
|
10
|
+
* Fixed CW versions to use stored_version of original PR #263
|
11
|
+
|
2
12
|
1.8.2 / 2017-11-22
|
3
13
|
==================
|
4
14
|
|
@@ -11,14 +11,17 @@ module Cloudinary::CarrierWave
|
|
11
11
|
base.storage Cloudinary::CarrierWave::Storage
|
12
12
|
base.extend ClassMethods
|
13
13
|
base.class_attribute :storage_type, :metadata
|
14
|
-
base
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
override_in_versions(base, :blank?, :full_public_id, :my_public_id, :all_versions_processors, :stored_version)
|
15
|
+
end
|
16
|
+
|
18
17
|
def is_main_uploader?
|
19
18
|
self.class.version_names.blank?
|
20
19
|
end
|
21
|
-
|
20
|
+
|
21
|
+
def stored_version
|
22
|
+
@stored_version
|
23
|
+
end
|
24
|
+
|
22
25
|
def retrieve_from_store!(identifier)
|
23
26
|
# Workaround cloudinary-mongoid hack of setting column to _old_ before saving it.
|
24
27
|
mongoid_blank = defined?(Mongoid::Extensions::Object) && self.is_a?(Mongoid::Extensions::Object) && identifier == "_old_"
|
@@ -31,7 +34,7 @@ module Cloudinary::CarrierWave
|
|
31
34
|
@stored_version = @file.version
|
32
35
|
self.original_filename = sanitize(@file.filename)
|
33
36
|
end
|
34
|
-
end
|
37
|
+
end
|
35
38
|
|
36
39
|
def url(*args)
|
37
40
|
if args.first && !args.first.is_a?(Hash)
|
@@ -48,7 +51,7 @@ module Cloudinary::CarrierWave
|
|
48
51
|
options[:version] ||= self.stored_version
|
49
52
|
end
|
50
53
|
options = self.transformation.merge(options) if self.version_name.present?
|
51
|
-
|
54
|
+
|
52
55
|
Cloudinary::Utils.cloudinary_url(public_id, {:format=>self.format, :resource_type=>self.resource_type, :type=>self.storage_type}.merge(options))
|
53
56
|
end
|
54
57
|
end
|
@@ -57,7 +60,7 @@ module Cloudinary::CarrierWave
|
|
57
60
|
return nil if self.blank?
|
58
61
|
return self.my_public_id if self.stored_version.blank?
|
59
62
|
return "v#{self.stored_version}/#{self.my_public_id}"
|
60
|
-
end
|
63
|
+
end
|
61
64
|
|
62
65
|
def filename
|
63
66
|
return nil if self.blank?
|
@@ -68,60 +71,60 @@ module Cloudinary::CarrierWave
|
|
68
71
|
def default_public_id
|
69
72
|
nil
|
70
73
|
end
|
71
|
-
|
72
|
-
# public_id to use for uploaded file. Can be overridden by caller. Random public_id will be used otherwise.
|
74
|
+
|
75
|
+
# public_id to use for uploaded file. Can be overridden by caller. Random public_id will be used otherwise.
|
73
76
|
def public_id
|
74
77
|
nil
|
75
78
|
end
|
76
|
-
|
79
|
+
|
77
80
|
# If the user overrode public_id, that should be used, even if it's different from current public_id in the database.
|
78
81
|
# Otherwise, try to use public_id from the database.
|
79
82
|
# Otherwise, generate a new random public_id
|
80
83
|
def my_public_id
|
81
|
-
@public_id ||= self.public_id
|
84
|
+
@public_id ||= self.public_id
|
82
85
|
@public_id ||= @stored_public_id
|
83
86
|
@public_id ||= Cloudinary::Utils.random_public_id
|
84
87
|
end
|
85
|
-
|
88
|
+
|
86
89
|
def rename(to_public_id = nil, overwrite=false)
|
87
|
-
public_id_overwrite = self.public_id
|
90
|
+
public_id_overwrite = self.public_id
|
88
91
|
to_public_id ||= public_id_overwrite
|
89
|
-
if public_id_overwrite && to_public_id != public_id_overwrite
|
92
|
+
if public_id_overwrite && to_public_id != public_id_overwrite
|
90
93
|
raise CloudinaryException, "The public_id method was overridden and returns #{public_id_overwrite} - can't rename to #{to_public_id}"
|
91
94
|
elsif to_public_id.nil?
|
92
95
|
raise CloudinaryException, "No to_public_id given"
|
93
96
|
end
|
94
|
-
|
97
|
+
|
95
98
|
from_public_id = @stored_public_id || self.my_public_id
|
96
99
|
return if from_public_id == to_public_id
|
97
|
-
|
100
|
+
|
98
101
|
@public_id = @stored_public_id = to_public_id
|
99
102
|
if self.resource_type == 'raw'
|
100
|
-
from_public_id = [from_public_id, self.format].join(".")
|
103
|
+
from_public_id = [from_public_id, self.format].join(".")
|
101
104
|
to_public_id = [to_public_id, self.format].join(".")
|
102
105
|
end
|
103
106
|
Cloudinary::Uploader.rename(from_public_id, to_public_id, :type=>self.storage_type, :resource_type=>self.resource_type, :overwrite=>overwrite)
|
104
107
|
storage.store_cloudinary_identifier(@stored_version, [@public_id, self.format].join("."))
|
105
|
-
end
|
108
|
+
end
|
106
109
|
|
107
110
|
def recreate_versions!
|
108
111
|
# Do nothing
|
109
112
|
end
|
110
|
-
|
113
|
+
|
111
114
|
def cache_versions!(new_file=nil)
|
112
115
|
# Do nothing
|
113
116
|
end
|
114
|
-
|
117
|
+
|
115
118
|
def process!(new_file=nil)
|
116
119
|
# Do nothing
|
117
120
|
end
|
118
|
-
|
121
|
+
|
119
122
|
SANITIZE_REGEXP = CarrierWave::SanitizedFile.respond_to?(:sanitize_regexp) ? CarrierWave::SanitizedFile.sanitize_regexp : /[^a-zA-Z0-9\.\-\+_]/
|
120
123
|
def sanitize(filename)
|
121
124
|
return nil if filename.nil?
|
122
125
|
filename.gsub(SANITIZE_REGEXP, '_')
|
123
126
|
end
|
124
|
-
|
127
|
+
|
125
128
|
# Should removed files be removed from Cloudinary as well. Can be overridden.
|
126
129
|
def delete_remote?
|
127
130
|
true
|
@@ -131,7 +134,7 @@ module Cloudinary::CarrierWave
|
|
131
134
|
def cloudinary_should_handle_remote?
|
132
135
|
true
|
133
136
|
end
|
134
|
-
|
137
|
+
|
135
138
|
# Rename preloaded uploads if public_id was overridden
|
136
139
|
def auto_rename_preloaded?
|
137
140
|
true
|
@@ -141,7 +144,7 @@ module Cloudinary::CarrierWave
|
|
141
144
|
def use_extended_identifier?
|
142
145
|
true
|
143
146
|
end
|
144
|
-
|
147
|
+
|
145
148
|
class CloudinaryFile
|
146
149
|
attr_reader :identifier, :public_id, :filename, :format, :version, :storage_type, :resource_type
|
147
150
|
def initialize(identifier, uploader)
|
@@ -158,36 +161,36 @@ module Cloudinary::CarrierWave
|
|
158
161
|
@filename = $2
|
159
162
|
else
|
160
163
|
@filename = @identifier
|
161
|
-
@version = nil
|
164
|
+
@version = nil
|
162
165
|
end
|
163
166
|
|
164
167
|
@storage_type ||= uploader.class.storage_type
|
165
|
-
@resource_type ||= Cloudinary::Utils.resource_type_for_format(@filename)
|
166
|
-
@public_id, @format = Cloudinary::PreloadedFile.split_format(@filename)
|
168
|
+
@resource_type ||= Cloudinary::Utils.resource_type_for_format(@filename)
|
169
|
+
@public_id, @format = Cloudinary::PreloadedFile.split_format(@filename)
|
167
170
|
end
|
168
171
|
|
169
172
|
def storage_identifier
|
170
173
|
identifier
|
171
174
|
end
|
172
|
-
|
175
|
+
|
173
176
|
def delete
|
174
177
|
public_id = @resource_type == "raw" ? self.filename : self.public_id
|
175
|
-
Cloudinary::Uploader.destroy(public_id, :type=>self.storage_type, :resource_type=>self.resource_type) if @uploader.delete_remote?
|
178
|
+
Cloudinary::Uploader.destroy(public_id, :type=>self.storage_type, :resource_type=>self.resource_type) if @uploader.delete_remote?
|
176
179
|
end
|
177
|
-
|
180
|
+
|
178
181
|
def exists?
|
179
182
|
public_id = @resource_type == "raw" ? self.filename : self.public_id
|
180
183
|
Cloudinary::Uploader.exists?(public_id, :version=>self.version, :type=>self.storage_type, :resource_type=>self.resource_type)
|
181
184
|
end
|
182
|
-
|
185
|
+
|
183
186
|
def read(options={})
|
184
187
|
parameters={:type=>self.storage_type, :resource_type=>self.resource_type}.merge(options)
|
185
188
|
Cloudinary::Downloader.download(self.identifier, parameters)
|
186
189
|
end
|
187
190
|
|
188
191
|
end
|
189
|
-
|
190
|
-
# @deprecated
|
192
|
+
|
193
|
+
# @deprecated
|
191
194
|
def self.split_format(identifier)
|
192
195
|
return Cloudinary::PreloadedFile.split_format(identifier)
|
193
196
|
end
|
@@ -203,7 +206,7 @@ module Cloudinary::CarrierWave
|
|
203
206
|
def resource_type
|
204
207
|
@file.respond_to?(:resource_type) ? @file.resource_type : Cloudinary::Utils.resource_type_for_format(requested_format || original_filename || default_format)
|
205
208
|
end
|
206
|
-
|
209
|
+
|
207
210
|
# For the given methods - versions should call the main uploader method
|
208
211
|
def self.override_in_versions(base, *methods)
|
209
212
|
methods.each do
|
@@ -211,8 +214,8 @@ module Cloudinary::CarrierWave
|
|
211
214
|
base.send :define_method, method do
|
212
215
|
return super() if self.version_name.blank?
|
213
216
|
uploader = self.model.send(self.mounted_as)
|
214
|
-
uploader.send(method)
|
217
|
+
uploader.send(method)
|
215
218
|
end
|
216
|
-
end
|
219
|
+
end
|
217
220
|
end
|
218
221
|
end
|
data/lib/cloudinary/utils.rb
CHANGED
@@ -681,7 +681,7 @@ class Cloudinary::Utils
|
|
681
681
|
# @private
|
682
682
|
def self.encode_context(hash)
|
683
683
|
case hash
|
684
|
-
when Hash then hash.map{|k,v| "#{k}=#{v.gsub(/([=|])/, '\\\\\1')}"}.join("|")
|
684
|
+
when Hash then hash.map{|k,v| "#{k}=#{v.to_s.gsub(/([=|])/, '\\\\\1')}"}.join("|")
|
685
685
|
when nil then ""
|
686
686
|
else hash
|
687
687
|
end
|
@@ -854,7 +854,7 @@ class Cloudinary::Utils
|
|
854
854
|
# @private
|
855
855
|
def self.fully_unescape(source)
|
856
856
|
i = 0
|
857
|
-
while source != CGI.unescape(source) && i <10
|
857
|
+
while source != CGI.unescape(source.gsub('+', '%2B')) && i <10
|
858
858
|
source = CGI.unescape(source.gsub('+', '%2B')) # don't let unescape replace '+' with space
|
859
859
|
i = i + 1
|
860
860
|
end
|
data/lib/cloudinary/version.rb
CHANGED
data/spec/auth_token_spec.rb
CHANGED
@@ -58,11 +58,11 @@ describe 'auth_token' do
|
|
58
58
|
it "should raise if key is not provided" do
|
59
59
|
Cloudinary.config.auth_token[:key] = nil
|
60
60
|
token = { :expiration => 111111, :duration => 0 }
|
61
|
-
expect{Cloudinary::Utils.generate_auth_token(token)}.to raise_error
|
61
|
+
expect{Cloudinary::Utils.generate_auth_token(token)}.to raise_error(/Missing auth token key configuration/)
|
62
62
|
end
|
63
63
|
it "should raise if expiration and duration are not provided" do
|
64
64
|
token = { :key => KEY, :expiration => 0, :duration => 0 }
|
65
|
-
expect{Cloudinary::Utils.generate_auth_token(token)}.to raise_error
|
65
|
+
expect{Cloudinary::Utils.generate_auth_token(token)}.to raise_error(/Must provide either expiration or duration/)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
describe "authentication token" do
|
@@ -163,7 +163,7 @@ RSpec.describe CloudinaryHelper do
|
|
163
163
|
|
164
164
|
after :each do
|
165
165
|
Cloudinary.config.static_image_support = @static_support
|
166
|
-
Cloudinary::Static::METADATA_FILE = @static_file
|
166
|
+
Kernel::silence_warnings { Cloudinary::Static::METADATA_FILE = @static_file }
|
167
167
|
Cloudinary::Static.reset_metadata
|
168
168
|
end
|
169
169
|
|
@@ -175,7 +175,7 @@ RSpec.describe CloudinaryHelper do
|
|
175
175
|
Cloudinary.config.static_image_support = false
|
176
176
|
expect(helper.image_path('/images/foo.jpg')).to eq('/images/foo.jpg')
|
177
177
|
expect(helper.image_path('some-folder/foo.gif')).to eq("/images/some-folder/foo.gif")
|
178
|
-
Cloudinary::Static::METADATA_FILE = "spec/sample_asset_file.tsv"
|
178
|
+
Kernel::silence_warnings { Cloudinary::Static::METADATA_FILE = "spec/sample_asset_file.tsv"}
|
179
179
|
Cloudinary::Static.reset_metadata
|
180
180
|
expect(helper.image_path('/images/foo.jpg'))
|
181
181
|
.to eq("/images/foo.jpg")
|
data/spec/uploader_spec.rb
CHANGED
@@ -275,10 +275,6 @@ describe Cloudinary::Uploader do
|
|
275
275
|
it "should support requesting detection" do
|
276
276
|
expect{Cloudinary::Uploader.upload(TEST_IMG, { :detection => :illegal, :tags => [TEST_TAG, TIMESTAMP_TAG]})}.to raise_error(CloudinaryException, /Illegal value|not a valid/)
|
277
277
|
end
|
278
|
-
|
279
|
-
it "should support requesting auto_tagging" do
|
280
|
-
expect{Cloudinary::Uploader.upload(TEST_IMG, { :auto_tagging => 0.5, :tags => [TEST_TAG, TIMESTAMP_TAG]})}.to raise_error(CloudinaryException, /Must use/)
|
281
|
-
end
|
282
278
|
|
283
279
|
it "should support upload_large", :large => true do
|
284
280
|
io = StringIO.new
|
data/spec/utils_spec.rb
CHANGED
@@ -876,4 +876,20 @@ describe Cloudinary::Utils do
|
|
876
876
|
|
877
877
|
end
|
878
878
|
end
|
879
|
+
|
880
|
+
describe "context" do
|
881
|
+
it 'should escape pipe and backslash characters' do
|
882
|
+
context = {"caption" => "different = caption", "alt2" => "alt|alternative"}
|
883
|
+
result = Cloudinary::Utils.encode_context(context)
|
884
|
+
expect(result).to eq("caption=different \\= caption|alt2=alt\\|alternative")
|
885
|
+
.or eq("alt2=alt\\|alternative|caption=different \\= caption")
|
886
|
+
|
887
|
+
end
|
888
|
+
it 'should support symbols' do
|
889
|
+
context = {:symbol_key => "string_value", "string_key" => :symbol_value}
|
890
|
+
result = Cloudinary::Utils.encode_context(context)
|
891
|
+
expect(result).to eq("string_key=symbol_value|symbol_key=string_value")
|
892
|
+
.or eq("symbol_key=string_value|string_key=symbol_value")
|
893
|
+
end
|
894
|
+
end
|
879
895
|
end
|
@@ -1,2 +1,2 @@
|
|
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,b,
|
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
2
|
//# sourceMappingURL=canvas-to-blob.min.js.map
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/**
|
3
|
-
* Cloudinary's JavaScript library - Version 2.
|
3
|
+
* Cloudinary's JavaScript library - Version 2.4.0
|
4
4
|
* Copyright Cloudinary
|
5
5
|
* see https://github.com/cloudinary/cloudinary_js
|
6
6
|
*
|
@@ -30,7 +30,13 @@ var slice = [].slice,
|
|
30
30
|
/*
|
31
31
|
* Includes common utility methods and shims
|
32
32
|
*/
|
33
|
-
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Return true if all items in list are strings
|
36
|
+
* @function Util.allString
|
37
|
+
* @param {Array} list - an array of items
|
38
|
+
*/
|
39
|
+
var ArrayParam, BaseUtil, ClientHintsMetaTag, Cloudinary, CloudinaryJQuery, Condition, Configuration, Expression, ExpressionParam, FetchLayer, HtmlTag, ImageTag, Layer, LayerParam, Param, RangeParam, RawParam, SubtitlesLayer, TextLayer, Transformation, TransformationBase, TransformationParam, Util, VideoTag, addClass, allStrings, base64Encode, base64EncodeURL, camelCase, cloneDeep, cloudinary, compact, contains, convertKeys, crc32, defaults, difference, funcTag, functions, getAttribute, getData, hasClass, identity, isEmpty, isFunction, isNumberLike, isObject, isString, m, merge, objToString, objectProto, parameters, reWords, removeAttribute, setAttribute, setAttributes, setData, smartEscape, snakeCase, utf8_encode, webp, width, withCamelCaseKeys, withSnakeCaseKeys, without;
|
34
40
|
allStrings = function(list) {
|
35
41
|
var item, j, len;
|
36
42
|
for (j = 0, len = list.length; j < len; j++) {
|
@@ -41,6 +47,14 @@ var slice = [].slice,
|
|
41
47
|
}
|
42
48
|
return true;
|
43
49
|
};
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Creates a new array without the given item.
|
53
|
+
* @function Util.without
|
54
|
+
* @param {Array} array - original array
|
55
|
+
* @param {*} item - the item to exclude from the new array
|
56
|
+
* @return {Array} a new array made of the original array's items except for `item`
|
57
|
+
*/
|
44
58
|
without = function(array, item) {
|
45
59
|
var i, length, newArray;
|
46
60
|
newArray = [];
|
@@ -53,9 +67,29 @@ var slice = [].slice,
|
|
53
67
|
}
|
54
68
|
return newArray;
|
55
69
|
};
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Return true is value is a number or a string representation of a number.
|
73
|
+
* @function Util.isNumberLike
|
74
|
+
* @param {*} value
|
75
|
+
* @returns {boolean} true if value is a number
|
76
|
+
* @example
|
77
|
+
* Util.isNumber(0) // true
|
78
|
+
* Util.isNumber("1.3") // true
|
79
|
+
* Util.isNumber("") // false
|
80
|
+
* Util.isNumber(undefined) // false
|
81
|
+
*/
|
56
82
|
isNumberLike = function(value) {
|
57
83
|
return (value != null) && !isNaN(parseFloat(value));
|
58
84
|
};
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Escape all characters matching unsafe in the given string
|
88
|
+
* @function Util.smartEscape
|
89
|
+
* @param {string} string - source string to escape
|
90
|
+
* @param {RegExp} unsafe - characters that must be escaped
|
91
|
+
* @return {string} escaped string
|
92
|
+
*/
|
59
93
|
smartEscape = function(string, unsafe) {
|
60
94
|
if (unsafe == null) {
|
61
95
|
unsafe = /([^a-zA-Z0-9_.\-\/:]+)/g;
|
@@ -66,6 +100,15 @@ var slice = [].slice,
|
|
66
100
|
}).join("");
|
67
101
|
});
|
68
102
|
};
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Assign values from sources if they are not defined in the destination.
|
106
|
+
* Once a value is set it does not change
|
107
|
+
* @function Util.defaults
|
108
|
+
* @param {Object} destination - the object to assign defaults to
|
109
|
+
* @param {...Object} source - the source object(s) to assign defaults from
|
110
|
+
* @return {Object} destination after it was modified
|
111
|
+
*/
|
69
112
|
defaults = function() {
|
70
113
|
var destination, sources;
|
71
114
|
destination = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
@@ -81,6 +124,59 @@ var slice = [].slice,
|
|
81
124
|
}, destination);
|
82
125
|
};
|
83
126
|
|
127
|
+
/*********** lodash functions */
|
128
|
+
objectProto = Object.prototype;
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
132
|
+
* of values.
|
133
|
+
*/
|
134
|
+
objToString = objectProto.toString;
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
138
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
139
|
+
*
|
140
|
+
* @param {*} value The value to check.
|
141
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
142
|
+
* @example
|
143
|
+
*
|
144
|
+
#isObject({});
|
145
|
+
* // => true
|
146
|
+
*
|
147
|
+
#isObject([1, 2, 3]);
|
148
|
+
* // => true
|
149
|
+
*
|
150
|
+
#isObject(1);
|
151
|
+
* // => false
|
152
|
+
*/
|
153
|
+
isObject = function(value) {
|
154
|
+
var type;
|
155
|
+
type = typeof value;
|
156
|
+
return !!value && (type === 'object' || type === 'function');
|
157
|
+
};
|
158
|
+
funcTag = '[object Function]';
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Checks if `value` is classified as a `Function` object.
|
162
|
+
* @function Util.isFunction
|
163
|
+
* @param {*} value The value to check.
|
164
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
165
|
+
* @example
|
166
|
+
*
|
167
|
+
* function Foo(){};
|
168
|
+
* isFunction(Foo);
|
169
|
+
* // => true
|
170
|
+
*
|
171
|
+
* isFunction(/abc/);
|
172
|
+
* // => false
|
173
|
+
*/
|
174
|
+
isFunction = function(value) {
|
175
|
+
return isObject(value) && objToString.call(value) === funcTag;
|
176
|
+
};
|
177
|
+
|
178
|
+
/*********** lodash functions */
|
179
|
+
|
84
180
|
/** Used to match words to create compound words. */
|
85
181
|
reWords = (function() {
|
86
182
|
var lower, upper;
|
@@ -88,6 +184,13 @@ var slice = [].slice,
|
|
88
184
|
lower = '[a-z]+';
|
89
185
|
return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
|
90
186
|
})();
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Convert string to camelCase
|
190
|
+
* @function Util.camelCase
|
191
|
+
* @param {string} string - the string to convert
|
192
|
+
* @return {string} in camelCase format
|
193
|
+
*/
|
91
194
|
camelCase = function(source) {
|
92
195
|
var i, word, words;
|
93
196
|
words = source.match(reWords);
|
@@ -107,6 +210,13 @@ var slice = [].slice,
|
|
107
210
|
})();
|
108
211
|
return words.join('');
|
109
212
|
};
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Convert string to snake_case
|
216
|
+
* @function Util.snakeCase
|
217
|
+
* @param {string} string - the string to convert
|
218
|
+
* @return {string} in snake_case format
|
219
|
+
*/
|
110
220
|
snakeCase = function(source) {
|
111
221
|
var i, word, words;
|
112
222
|
words = source.match(reWords);
|
@@ -136,64 +246,65 @@ var slice = [].slice,
|
|
136
246
|
}
|
137
247
|
return result;
|
138
248
|
};
|
249
|
+
|
250
|
+
/**
|
251
|
+
* Create a copy of the source object with all keys in camelCase
|
252
|
+
* @function Util.withCamelCaseKeys
|
253
|
+
* @param {Object} value - the object to copy
|
254
|
+
* @return {Object} a new object
|
255
|
+
*/
|
139
256
|
withCamelCaseKeys = function(source) {
|
140
257
|
return convertKeys(source, Util.camelCase);
|
141
258
|
};
|
259
|
+
|
260
|
+
/**
|
261
|
+
* Create a copy of the source object with all keys in snake_case
|
262
|
+
* @function Util.withSnakeCaseKeys
|
263
|
+
* @param {Object} value - the object to copy
|
264
|
+
* @return {Object} a new object
|
265
|
+
*/
|
142
266
|
withSnakeCaseKeys = function(source) {
|
143
267
|
return convertKeys(source, Util.snakeCase);
|
144
268
|
};
|
145
|
-
|
269
|
+
base64Encode = typeof btoa !== 'undefined' && isFunction(btoa) ? btoa : typeof Buffer !== 'undefined' && isFunction(Buffer) ? function(input) {
|
270
|
+
if (!(input instanceof Buffer)) {
|
271
|
+
input = new Buffer.from(String(input), 'binary');
|
272
|
+
}
|
273
|
+
return input.toString('base64');
|
274
|
+
} : function(input) {
|
275
|
+
throw new Error("No base64 encoding function found");
|
276
|
+
};
|
146
277
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
278
|
+
/**
|
279
|
+
* Returns the Base64-decoded version of url.<br>
|
280
|
+
* This method delegates to `btoa` if present. Otherwise it tries `Buffer`.
|
281
|
+
* @function Util.base64EncodeURL
|
282
|
+
* @param {string} url - the url to encode. the value is URIdecoded and then re-encoded before converting to base64 representation
|
283
|
+
* @return {string} the base64 representation of the URL
|
284
|
+
*/
|
285
|
+
base64EncodeURL = function(input) {
|
286
|
+
var error1, ignore;
|
287
|
+
try {
|
288
|
+
input = decodeURI(input);
|
289
|
+
} catch (error1) {
|
290
|
+
ignore = error1;
|
291
|
+
}
|
292
|
+
input = encodeURI(input);
|
293
|
+
return base64Encode(input);
|
294
|
+
};
|
295
|
+
BaseUtil = {
|
151
296
|
allStrings: allStrings,
|
152
|
-
|
153
|
-
/**
|
154
|
-
* Convert string to camelCase
|
155
|
-
* @param {string} string - the string to convert
|
156
|
-
* @return {string} in camelCase format
|
157
|
-
*/
|
158
297
|
camelCase: camelCase,
|
159
298
|
convertKeys: convertKeys,
|
160
|
-
|
161
|
-
/**
|
162
|
-
* Assign values from sources if they are not defined in the destination.
|
163
|
-
* Once a value is set it does not change
|
164
|
-
* @param {Object} destination - the object to assign defaults to
|
165
|
-
* @param {...Object} source - the source object(s) to assign defaults from
|
166
|
-
* @return {Object} destination after it was modified
|
167
|
-
*/
|
168
299
|
defaults: defaults,
|
169
|
-
|
170
|
-
/**
|
171
|
-
* Convert string to snake_case
|
172
|
-
* @param {string} string - the string to convert
|
173
|
-
* @return {string} in snake_case format
|
174
|
-
*/
|
175
300
|
snakeCase: snakeCase,
|
176
|
-
|
177
|
-
/**
|
178
|
-
* Creates a new array without the given item.
|
179
|
-
* @param {Array} array - original array
|
180
|
-
* @param {*} item - the item to exclude from the new array
|
181
|
-
* @return {Array} a new array made of the original array's items except for `item`
|
182
|
-
*/
|
183
301
|
without: without,
|
184
|
-
|
185
|
-
/**
|
186
|
-
* Return true is value is a number or a string representation of a number.
|
187
|
-
* @example
|
188
|
-
* Util.isNumber(0) // true
|
189
|
-
* Util.isNumber("1.3") // true
|
190
|
-
* Util.isNumber("") // false
|
191
|
-
* Util.isNumber(undefined) // false
|
192
|
-
*/
|
302
|
+
isFunction: isFunction,
|
193
303
|
isNumberLike: isNumberLike,
|
194
304
|
smartEscape: smartEscape,
|
195
305
|
withCamelCaseKeys: withCamelCaseKeys,
|
196
|
-
withSnakeCaseKeys: withSnakeCaseKeys
|
306
|
+
withSnakeCaseKeys: withSnakeCaseKeys,
|
307
|
+
base64EncodeURL: base64EncodeURL
|
197
308
|
};
|
198
309
|
|
199
310
|
/**
|
@@ -217,6 +328,7 @@ var slice = [].slice,
|
|
217
328
|
* Set data in the DOM element.
|
218
329
|
*
|
219
330
|
* This method will use jQuery's `data()` method if it is available, otherwise it will set the `data-` attribute
|
331
|
+
* @function Util.setData
|
220
332
|
* @param {Element} element - the element to set the data in
|
221
333
|
* @param {string} name - the name of the data item
|
222
334
|
* @param {*} value - the value to be set
|
@@ -230,6 +342,7 @@ var slice = [].slice,
|
|
230
342
|
* Get attribute from the DOM element.
|
231
343
|
*
|
232
344
|
* This method will use jQuery's `attr()` method if it is available, otherwise it will get the attribute directly
|
345
|
+
* @function Util.getAttribute
|
233
346
|
* @param {Element} element - the element to set the attribute for
|
234
347
|
* @param {string} name - the name of the attribute
|
235
348
|
* @returns {*} the value of the attribute
|
@@ -243,35 +356,90 @@ var slice = [].slice,
|
|
243
356
|
* Set attribute in the DOM element.
|
244
357
|
*
|
245
358
|
* This method will use jQuery's `attr()` method if it is available, otherwise it will set the attribute directly
|
359
|
+
* @function Util.setAttribute
|
246
360
|
* @param {Element} element - the element to set the attribute for
|
247
361
|
* @param {string} name - the name of the attribute
|
248
362
|
* @param {*} value - the value to be set
|
249
|
-
*
|
250
363
|
*/
|
251
364
|
setAttribute = function(element, name, value) {
|
252
365
|
return jQuery(element).attr(name, value);
|
253
366
|
};
|
367
|
+
|
368
|
+
/**
|
369
|
+
* Remove an attribute in the DOM element.
|
370
|
+
*
|
371
|
+
* @function Util.removeAttribute
|
372
|
+
* @param {Element} element - the element to set the attribute for
|
373
|
+
* @param {string} name - the name of the attribute
|
374
|
+
*/
|
254
375
|
removeAttribute = function(element, name) {
|
255
376
|
return jQuery(element).removeAttr(name);
|
256
377
|
};
|
378
|
+
|
379
|
+
/**
|
380
|
+
* Set a group of attributes to the element
|
381
|
+
* @function Util.setAttributes
|
382
|
+
* @param {Element} element - the element to set the attributes for
|
383
|
+
* @param {Object} attributes - a hash of attribute names and values
|
384
|
+
*/
|
257
385
|
setAttributes = function(element, attributes) {
|
258
386
|
return jQuery(element).attr(attributes);
|
259
387
|
};
|
388
|
+
|
389
|
+
/**
|
390
|
+
* Checks if element has a css class
|
391
|
+
* @function Util.hasClass
|
392
|
+
* @param {Element} element - the element to check
|
393
|
+
* @param {string} name - the class name
|
394
|
+
@returns {boolean} true if the element has the class
|
395
|
+
*/
|
260
396
|
hasClass = function(element, name) {
|
261
397
|
return jQuery(element).hasClass(name);
|
262
398
|
};
|
399
|
+
|
400
|
+
/**
|
401
|
+
* Add class to the element
|
402
|
+
* @function Util.addClass
|
403
|
+
* @param {Element} element - the element
|
404
|
+
* @param {string} name - the class name to add
|
405
|
+
*/
|
263
406
|
addClass = function(element, name) {
|
264
407
|
return jQuery(element).addClass(name);
|
265
408
|
};
|
266
409
|
width = function(element) {
|
267
410
|
return jQuery(element).width();
|
268
411
|
};
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Returns true if item is empty:
|
415
|
+
* <ul>
|
416
|
+
* <li>item is null or undefined</li>
|
417
|
+
* <li>item is an array or string of length 0</li>
|
418
|
+
* <li>item is an object with no keys</li>
|
419
|
+
* </ul>
|
420
|
+
* @function Util.isEmpty
|
421
|
+
* @param item
|
422
|
+
* @returns {boolean} true if item is empty
|
423
|
+
*/
|
269
424
|
isEmpty = function(item) {
|
270
425
|
return (item == null) || (jQuery.isArray(item) || Util.isString(item)) && item.length === 0 || (jQuery.isPlainObject(item) && jQuery.isEmptyObject(item));
|
271
426
|
};
|
427
|
+
|
428
|
+
/**
|
429
|
+
* Returns true if item is a string
|
430
|
+
* @param item
|
431
|
+
* @returns {boolean} true if item is a string
|
432
|
+
*/
|
272
433
|
isString = function(item) {
|
273
434
|
return typeof item === 'string' || (item != null ? item.toString() : void 0) === '[object String]';
|
274
435
|
};
|
436
|
+
|
437
|
+
/**
|
438
|
+
* Recursively assign source properties to destination
|
439
|
+
* @function Util.merge
|
440
|
+
* @param {Object} destination - the object to assign to
|
441
|
+
* @param {...Object} [sources] The source objects.
|
442
|
+
*/
|
275
443
|
merge = function() {
|
276
444
|
var args, i;
|
277
445
|
args = (function() {
|
@@ -286,6 +454,13 @@ var slice = [].slice,
|
|
286
454
|
args.unshift(true);
|
287
455
|
return jQuery.extend.apply(this, args);
|
288
456
|
};
|
457
|
+
|
458
|
+
/**
|
459
|
+
* Creates a new array from the parameter with "falsey" values removed
|
460
|
+
* @function Util.compact
|
461
|
+
* @param {Array} array - the array to remove values from
|
462
|
+
* @return {Array} a new array without falsey values
|
463
|
+
*/
|
289
464
|
compact = function(arr) {
|
290
465
|
var item, j, len, results;
|
291
466
|
results = [];
|
@@ -297,6 +472,13 @@ var slice = [].slice,
|
|
297
472
|
}
|
298
473
|
return results;
|
299
474
|
};
|
475
|
+
|
476
|
+
/**
|
477
|
+
* Create a new copy of the given object, including all internal objects.
|
478
|
+
* @function Util.cloneDeep
|
479
|
+
* @param {Object} value - the object to clone
|
480
|
+
* @return {Object} a new deep copy of the object
|
481
|
+
*/
|
300
482
|
cloneDeep = function() {
|
301
483
|
var args;
|
302
484
|
args = jQuery.makeArray(arguments);
|
@@ -304,6 +486,14 @@ var slice = [].slice,
|
|
304
486
|
args.unshift(true);
|
305
487
|
return jQuery.extend.apply(this, args);
|
306
488
|
};
|
489
|
+
|
490
|
+
/**
|
491
|
+
* Check if a given item is included in the given array
|
492
|
+
* @function Util.contains
|
493
|
+
* @param {Array} array - the array to search in
|
494
|
+
* @param {*} item - the item to search for
|
495
|
+
* @return {boolean} true if the item is included in the array
|
496
|
+
*/
|
307
497
|
contains = function(arr, item) {
|
308
498
|
var i, j, len;
|
309
499
|
for (j = 0, len = arr.length; j < len; j++) {
|
@@ -314,6 +504,14 @@ var slice = [].slice,
|
|
314
504
|
}
|
315
505
|
return false;
|
316
506
|
};
|
507
|
+
|
508
|
+
/**
|
509
|
+
* Returns values in the given array that are not included in the other array
|
510
|
+
* @function Util.difference
|
511
|
+
* @param {Array} arr - the array to select from
|
512
|
+
* @param {Array} values - values to filter from arr
|
513
|
+
* @return {Array} the filtered values
|
514
|
+
*/
|
317
515
|
difference = function(arr, values) {
|
318
516
|
var item, j, len, results;
|
319
517
|
results = [];
|
@@ -325,6 +523,13 @@ var slice = [].slice,
|
|
325
523
|
}
|
326
524
|
return results;
|
327
525
|
};
|
526
|
+
|
527
|
+
/**
|
528
|
+
* Returns a list of all the function names in obj
|
529
|
+
* @function Util.functions
|
530
|
+
* @param {Object} object - the object to inspect
|
531
|
+
* @return {Array} a list of functions of object
|
532
|
+
*/
|
328
533
|
functions = function(object) {
|
329
534
|
var i, results;
|
330
535
|
results = [];
|
@@ -335,6 +540,13 @@ var slice = [].slice,
|
|
335
540
|
}
|
336
541
|
return results;
|
337
542
|
};
|
543
|
+
|
544
|
+
/**
|
545
|
+
* Returns the provided value. This functions is used as a default predicate function.
|
546
|
+
* @function Util.identity
|
547
|
+
* @param {*} value
|
548
|
+
* @return {*} the provided value
|
549
|
+
*/
|
338
550
|
identity = function(value) {
|
339
551
|
return value;
|
340
552
|
};
|
@@ -359,71 +571,22 @@ var slice = [].slice,
|
|
359
571
|
/**
|
360
572
|
* Assign source properties to destination.
|
361
573
|
* If the property is an object it is assigned as a whole, overriding the destination object.
|
574
|
+
* @function Util.assign
|
362
575
|
* @param {Object} destination - the object to assign to
|
363
576
|
*/
|
364
577
|
assign: jQuery.extend,
|
365
|
-
|
366
|
-
/**
|
367
|
-
* Recursively assign source properties to destination
|
368
|
-
* @param {Object} destination - the object to assign to
|
369
|
-
* @param {...Object} [sources] The source objects.
|
370
|
-
*/
|
371
578
|
merge: merge,
|
372
|
-
|
373
|
-
/**
|
374
|
-
* Create a new copy of the given object, including all internal objects.
|
375
|
-
* @param {Object} value - the object to clone
|
376
|
-
* @return {Object} a new deep copy of the object
|
377
|
-
*/
|
378
579
|
cloneDeep: cloneDeep,
|
379
|
-
|
380
|
-
/**
|
381
|
-
* Creates a new array from the parameter with "falsey" values removed
|
382
|
-
* @param {Array} array - the array to remove values from
|
383
|
-
* @return {Array} a new array without falsey values
|
384
|
-
*/
|
385
580
|
compact: compact,
|
386
|
-
|
387
|
-
/**
|
388
|
-
* Check if a given item is included in the given array
|
389
|
-
* @param {Array} array - the array to search in
|
390
|
-
* @param {*} item - the item to search for
|
391
|
-
* @return {boolean} true if the item is included in the array
|
392
|
-
*/
|
393
581
|
contains: contains,
|
394
|
-
|
395
|
-
/**
|
396
|
-
* Returns values in the given array that are not included in the other array
|
397
|
-
* @param {Array} arr - the array to select from
|
398
|
-
* @param {Array} values - values to filter from arr
|
399
|
-
* @return {Array} the filtered values
|
400
|
-
*/
|
401
582
|
difference: difference,
|
402
|
-
|
403
|
-
/**
|
404
|
-
* Returns true if argument is a function.
|
405
|
-
* @param {*} value - the value to check
|
406
|
-
* @return {boolean} true if the value is a function
|
407
|
-
*/
|
408
|
-
isFunction: jQuery.isFunction,
|
409
|
-
|
410
|
-
/**
|
411
|
-
* Returns a list of all the function names in obj
|
412
|
-
* @param {Object} object - the object to inspect
|
413
|
-
* @return {Array} a list of functions of object
|
414
|
-
*/
|
415
583
|
functions: functions,
|
416
|
-
|
417
|
-
/**
|
418
|
-
* Returns the provided value. This functions is used as a default predicate function.
|
419
|
-
* @param {*} value
|
420
|
-
* @return {*} the provided value
|
421
|
-
*/
|
422
584
|
identity: identity,
|
423
585
|
isPlainObject: jQuery.isPlainObject,
|
424
586
|
|
425
587
|
/**
|
426
588
|
* Remove leading or trailing spaces from text
|
589
|
+
* @function Util.trim
|
427
590
|
* @param {string} text
|
428
591
|
* @return {string} the `text` without leading or trailing spaces
|
429
592
|
*/
|
@@ -589,6 +752,44 @@ var slice = [].slice,
|
|
589
752
|
return Layer;
|
590
753
|
|
591
754
|
})();
|
755
|
+
FetchLayer = (function(superClass) {
|
756
|
+
extend(FetchLayer, superClass);
|
757
|
+
|
758
|
+
|
759
|
+
/**
|
760
|
+
* @constructor FetchLayer
|
761
|
+
* @param {Object|string} options - layer parameters or a url
|
762
|
+
* @param {string} options.url the url of the image to fetch
|
763
|
+
*/
|
764
|
+
|
765
|
+
function FetchLayer(options) {
|
766
|
+
FetchLayer.__super__.constructor.call(this, options);
|
767
|
+
if (Util.isString(options)) {
|
768
|
+
this.options.url = options;
|
769
|
+
} else if (options != null ? options.url : void 0) {
|
770
|
+
this.options.url = options.url;
|
771
|
+
}
|
772
|
+
}
|
773
|
+
|
774
|
+
FetchLayer.prototype.url = function(url) {
|
775
|
+
this.options.url = url;
|
776
|
+
return this;
|
777
|
+
};
|
778
|
+
|
779
|
+
|
780
|
+
/**
|
781
|
+
* generate the string representation of the layer
|
782
|
+
* @function FetchLayer#toString
|
783
|
+
* @return {String}
|
784
|
+
*/
|
785
|
+
|
786
|
+
FetchLayer.prototype.toString = function() {
|
787
|
+
return "fetch:" + (cloudinary.Util.base64EncodeURL(this.options.url));
|
788
|
+
};
|
789
|
+
|
790
|
+
return FetchLayer;
|
791
|
+
|
792
|
+
})(Layer);
|
592
793
|
TextLayer = (function(superClass) {
|
593
794
|
extend(TextLayer, superClass);
|
594
795
|
|
@@ -1118,13 +1319,18 @@ var slice = [].slice,
|
|
1118
1319
|
var layerOptions, result;
|
1119
1320
|
layerOptions = this.origValue;
|
1120
1321
|
if (cloudinary.Util.isPlainObject(layerOptions)) {
|
1121
|
-
|
1322
|
+
layerOptions = Util.withCamelCaseKeys(layerOptions);
|
1323
|
+
if (layerOptions.resourceType === "text" || (layerOptions.text != null)) {
|
1122
1324
|
result = new cloudinary.TextLayer(layerOptions).toString();
|
1123
|
-
} else if (layerOptions.
|
1325
|
+
} else if (layerOptions.resourceType === "subtitles") {
|
1124
1326
|
result = new cloudinary.SubtitlesLayer(layerOptions).toString();
|
1327
|
+
} else if (layerOptions.resourceType === "fetch" || (layerOptions.url != null)) {
|
1328
|
+
result = new cloudinary.FetchLayer(layerOptions).toString();
|
1125
1329
|
} else {
|
1126
1330
|
result = new cloudinary.Layer(layerOptions).toString();
|
1127
1331
|
}
|
1332
|
+
} else if (/^fetch:.+/.test(layerOptions)) {
|
1333
|
+
result = new FetchLayer(layerOptions.substr(6)).toString();
|
1128
1334
|
} else {
|
1129
1335
|
result = layerOptions;
|
1130
1336
|
}
|
@@ -1767,7 +1973,7 @@ var slice = [].slice,
|
|
1767
1973
|
var cloudinary_url, j, k, len, query, ref1, ref2, ref3, uri, uriRegex, v, value;
|
1768
1974
|
cloudinary_url = typeof process !== "undefined" && process !== null ? (ref1 = process.env) != null ? ref1.CLOUDINARY_URL : void 0 : void 0;
|
1769
1975
|
if (cloudinary_url != null) {
|
1770
|
-
uriRegex = /cloudinary:\/\/(?:(\w+)(?:\:(\w+))?@)?([\w\.-]+)(?:\/([^?]*))?(?:\?(.+))?/;
|
1976
|
+
uriRegex = /cloudinary:\/\/(?:(\w+)(?:\:([\w-]+))?@)?([\w\.-]+)(?:\/([^?]*))?(?:\?(.+))?/;
|
1771
1977
|
uri = uriRegex.exec(cloudinary_url);
|
1772
1978
|
if (uri) {
|
1773
1979
|
if (uri[3] != null) {
|
@@ -3256,7 +3462,7 @@ var slice = [].slice,
|
|
3256
3462
|
Cloudinary = (function() {
|
3257
3463
|
var AKAMAI_SHARED_CDN, CF_SHARED_CDN, DEFAULT_POSTER_OPTIONS, DEFAULT_VIDEO_SOURCE_TYPES, OLD_AKAMAI_SHARED_CDN, SHARED_CDN, VERSION, absolutize, applyBreakpoints, cdnSubdomainNumber, closestAbove, cloudinaryUrlPrefix, defaultBreakpoints, finalizeResourceType, findContainerWidth, maxWidth, updateDpr;
|
3258
3464
|
|
3259
|
-
VERSION = "2.
|
3465
|
+
VERSION = "2.4.0";
|
3260
3466
|
|
3261
3467
|
CF_SHARED_CDN = "d3jpl91pxevbkh.cloudfront.net";
|
3262
3468
|
|
@@ -3396,6 +3602,9 @@ var slice = [].slice,
|
|
3396
3602
|
if (resourceType === 'image' && type === 'upload') {
|
3397
3603
|
resourceType = "images";
|
3398
3604
|
type = null;
|
3605
|
+
} else if (resourceType === 'image' && type === 'private') {
|
3606
|
+
resourceType = 'private_images';
|
3607
|
+
type = null;
|
3399
3608
|
} else if (resourceType === 'raw' && type === 'upload') {
|
3400
3609
|
resourceType = 'files';
|
3401
3610
|
type = null;
|
@@ -4489,10 +4698,11 @@ var slice = [].slice,
|
|
4489
4698
|
VideoTag: VideoTag,
|
4490
4699
|
ClientHintsMetaTag: ClientHintsMetaTag,
|
4491
4700
|
Layer: Layer,
|
4701
|
+
FetchLayer: FetchLayer,
|
4492
4702
|
TextLayer: TextLayer,
|
4493
4703
|
SubtitlesLayer: SubtitlesLayer,
|
4494
4704
|
Cloudinary: Cloudinary,
|
4495
|
-
VERSION: "2.
|
4705
|
+
VERSION: "2.4.0",
|
4496
4706
|
CloudinaryJQuery: CloudinaryJQuery
|
4497
4707
|
};
|
4498
4708
|
return cloudinary;
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* https://blueimp.net
|
7
7
|
*
|
8
8
|
* Licensed under the MIT license:
|
9
|
-
*
|
9
|
+
* https://opensource.org/licenses/MIT
|
10
10
|
*/
|
11
11
|
|
12
12
|
/* jshint nomen:false */
|
@@ -20,6 +20,7 @@
|
|
20
20
|
'jquery',
|
21
21
|
'load-image',
|
22
22
|
'load-image-meta',
|
23
|
+
'load-image-scale',
|
23
24
|
'load-image-exif',
|
24
25
|
'canvas-to-blob',
|
25
26
|
'./jquery.fileupload-process'
|
@@ -30,6 +31,7 @@
|
|
30
31
|
require('jquery'),
|
31
32
|
require('blueimp-load-image/js/load-image'),
|
32
33
|
require('blueimp-load-image/js/load-image-meta'),
|
34
|
+
require('blueimp-load-image/js/load-image-scale'),
|
33
35
|
require('blueimp-load-image/js/load-image-exif'),
|
34
36
|
require('blueimp-canvas-to-blob'),
|
35
37
|
require('./jquery.fileupload-process')
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* https://blueimp.net
|
7
7
|
*
|
8
8
|
* Licensed under the MIT license:
|
9
|
-
*
|
9
|
+
* https://opensource.org/licenses/MIT
|
10
10
|
*/
|
11
11
|
|
12
12
|
/* jshint nomen:false */
|
@@ -22,7 +22,10 @@
|
|
22
22
|
], factory);
|
23
23
|
} else if (typeof exports === 'object') {
|
24
24
|
// Node/CommonJS:
|
25
|
-
factory(
|
25
|
+
factory(
|
26
|
+
require('jquery'),
|
27
|
+
require('./jquery.fileupload')
|
28
|
+
);
|
26
29
|
} else {
|
27
30
|
// Browser globals:
|
28
31
|
factory(
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* https://blueimp.net
|
7
7
|
*
|
8
8
|
* Licensed under the MIT license:
|
9
|
-
*
|
9
|
+
* https://opensource.org/licenses/MIT
|
10
10
|
*/
|
11
11
|
|
12
12
|
/* global define, require, window */
|
@@ -21,7 +21,10 @@
|
|
21
21
|
], factory);
|
22
22
|
} else if (typeof exports === 'object') {
|
23
23
|
// Node/CommonJS:
|
24
|
-
factory(
|
24
|
+
factory(
|
25
|
+
require('jquery'),
|
26
|
+
require('./jquery.fileupload-process')
|
27
|
+
);
|
25
28
|
} else {
|
26
29
|
// Browser globals:
|
27
30
|
factory(
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* https://blueimp.net
|
7
7
|
*
|
8
8
|
* Licensed under the MIT license:
|
9
|
-
*
|
9
|
+
* https://opensource.org/licenses/MIT
|
10
10
|
*/
|
11
11
|
|
12
12
|
/* jshint nomen:false */
|
@@ -18,7 +18,7 @@
|
|
18
18
|
// Register as an anonymous AMD module:
|
19
19
|
define([
|
20
20
|
'jquery',
|
21
|
-
'jquery
|
21
|
+
'jquery-ui/ui/widget'
|
22
22
|
], factory);
|
23
23
|
} else if (typeof exports === 'object') {
|
24
24
|
// Node/CommonJS:
|
@@ -730,7 +730,7 @@
|
|
730
730
|
promise = dfd.promise(),
|
731
731
|
jqXHR,
|
732
732
|
upload;
|
733
|
-
if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
|
733
|
+
if (!(this._isXHRUpload(options) && slice && (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)) ||
|
734
734
|
options.data) {
|
735
735
|
return false;
|
736
736
|
}
|
@@ -753,7 +753,7 @@
|
|
753
753
|
o.blob = slice.call(
|
754
754
|
file,
|
755
755
|
ub,
|
756
|
-
ub + mcs,
|
756
|
+
ub + ($.type(mcs) === 'function' ? mcs(o) : mcs),
|
757
757
|
file.type
|
758
758
|
);
|
759
759
|
// Store the current chunk size, as the blob itself
|
@@ -1080,6 +1080,8 @@
|
|
1080
1080
|
_handleFileTreeEntry: function (entry, path) {
|
1081
1081
|
var that = this,
|
1082
1082
|
dfd = $.Deferred(),
|
1083
|
+
entries = [],
|
1084
|
+
dirReader,
|
1083
1085
|
errorHandler = function (e) {
|
1084
1086
|
if (e && !e.entry) {
|
1085
1087
|
e.entry = entry;
|
@@ -1107,8 +1109,7 @@
|
|
1107
1109
|
readEntries();
|
1108
1110
|
}
|
1109
1111
|
}, errorHandler);
|
1110
|
-
}
|
1111
|
-
dirReader, entries = [];
|
1112
|
+
};
|
1112
1113
|
path = path || '';
|
1113
1114
|
if (entry.isFile) {
|
1114
1115
|
if (entry._file) {
|
@@ -1311,6 +1312,10 @@
|
|
1311
1312
|
this._off(this.options.fileInput, 'change');
|
1312
1313
|
},
|
1313
1314
|
|
1315
|
+
_destroy: function () {
|
1316
|
+
this._destroyEventHandlers();
|
1317
|
+
},
|
1318
|
+
|
1314
1319
|
_setOption: function (key, value) {
|
1315
1320
|
var reinit = $.inArray(key, this._specialOptions) !== -1;
|
1316
1321
|
if (reinit) {
|
@@ -6,10 +6,10 @@
|
|
6
6
|
* https://blueimp.net
|
7
7
|
*
|
8
8
|
* Licensed under the MIT license:
|
9
|
-
*
|
9
|
+
* https://opensource.org/licenses/MIT
|
10
10
|
*/
|
11
11
|
|
12
|
-
/* global define, require, window, document */
|
12
|
+
/* global define, require, window, document, JSON */
|
13
13
|
|
14
14
|
;(function (factory) {
|
15
15
|
'use strict';
|
@@ -27,7 +27,14 @@
|
|
27
27
|
'use strict';
|
28
28
|
|
29
29
|
// Helper variable to create unique names for the transport iframes:
|
30
|
-
var counter = 0
|
30
|
+
var counter = 0,
|
31
|
+
jsonAPI = $,
|
32
|
+
jsonParse = 'parseJSON';
|
33
|
+
|
34
|
+
if ('JSON' in window && 'parse' in JSON) {
|
35
|
+
jsonAPI = JSON;
|
36
|
+
jsonParse = 'parse';
|
37
|
+
}
|
31
38
|
|
32
39
|
// The iframe transport accepts four additional options:
|
33
40
|
// options.fileInput: a jQuery collection of file input fields
|
@@ -197,7 +204,7 @@
|
|
197
204
|
return iframe && $(iframe[0].body).text();
|
198
205
|
},
|
199
206
|
'iframe json': function (iframe) {
|
200
|
-
return iframe &&
|
207
|
+
return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());
|
201
208
|
},
|
202
209
|
'iframe html': function (iframe) {
|
203
210
|
return iframe && $(iframe[0].body).html();
|
@@ -1,2 +1,2 @@
|
|
1
|
-
!function(e){"use strict";function t(e,i,a){var o,r=document.createElement("img");if(r.onerror=function(o){return t.onerror(r,o,e,i,a)},r.onload=function(o){return t.onload(r,o,e,i,a)},t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e))o=r._objectURL=t.createObjectURL(e);else{if("string"!=typeof e)return!1;o=e,a&&a.crossOrigin&&(r.crossOrigin=a.crossOrigin)}return o?(r.src=o,r):t.readFile(e,function(e){var t=e.target;t&&t.result?r.src=t.result:i&&i(e)})}function i(e,i){!e._objectURL||i&&i.noRevoke||(t.revokeObjectURL(e._objectURL),delete e._objectURL)}var a=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.transform=function(e,i,a,o,r){a(t.scale(e,i,r),r)},t.onerror=function(e,t,a,o,r){i(e,r),o&&o.call(e,t)},t.onload=function(e,a,o,r,n){i(e,n),r&&t.transform(e,n,r,o,{})},t.transformCoordinates=function(){},t.getTransformedOptions=function(e,t){var i,a,o,r,n=t.aspectRatio;if(!n)return t;i={};for(a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);return i.crop=!0,o=e.naturalWidth||e.width,r=e.naturalHeight||e.height,o/r>n?(i.maxWidth=r*n,i.maxHeight=r):(i.maxWidth=o,i.maxHeight=o/n),i},t.renderImageToCanvas=function(e,t,i,a,o,r,n,s,l,d){return e.getContext("2d").drawImage(t,i,a,o,r,n,s,l,d),e},t.hasCanvasOption=function(e){return e.canvas||e.crop||!!e.aspectRatio},t.scale=function(e,i,a){function o(){var e=Math.max((l||v)/v,(d||P)/P);e>1&&(v*=e,P*=e)}function r(){var e=Math.min((n||v)/v,(s||P)/P);e<1&&(v*=e,P*=e)}i=i||{};var n,s,l,d,u,c,f,g,h,m,p,S=document.createElement("canvas"),b=e.getContext||t.hasCanvasOption(i)&&S.getContext,x=e.naturalWidth||e.width,y=e.naturalHeight||e.height,v=x,P=y;if(b&&(i=t.getTransformedOptions(e,i,a),f=i.left||0,g=i.top||0,i.sourceWidth?(u=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(f=x-u-i.right)):u=x-f-(i.right||0),i.sourceHeight?(c=i.sourceHeight,void 0!==i.bottom&&void 0===i.top&&(g=y-c-i.bottom)):c=y-g-(i.bottom||0),v=u,P=c),n=i.maxWidth,s=i.maxHeight,l=i.minWidth,d=i.minHeight,b&&n&&s&&i.crop?(v=n,P=s,p=u/c-n/s,p<0?(c=s*u/n,void 0===i.top&&void 0===i.bottom&&(g=(y-c)/2)):p>0&&(u=n*c/s,void 0===i.left&&void 0===i.right&&(f=(x-u)/2))):((i.contain||i.cover)&&(l=n=n||l,d=s=s||d),i.cover?(r(),o()):(o(),r())),b){if(h=i.pixelRatio,h>1&&(S.style.width=v+"px",S.style.height=P+"px",v*=h,P*=h,S.getContext("2d").scale(h,h)),m=i.downsamplingRatio,m>0&&m<1&&v<u&&P<c)for(;u*m>v;)S.width=u*m,S.height=c*m,t.renderImageToCanvas(S,e,f,g,u,c,0,0,S.width,S.height),u=S.width,c=S.height,e=document.createElement("canvas"),e.width=u,e.height=c,t.renderImageToCanvas(e,S,0,0,u,c,0,0,u,c);return S.width=v,S.height=P,t.transformCoordinates(S,i),t.renderImageToCanvas(S,e,f,g,u,c,0,0,v,P)}return e.width=v,e.height=P,e},t.createObjectURL=function(e){return!!a&&a.createObjectURL(e)},t.revokeObjectURL=function(e){return!!a&&a.revokeObjectURL(e)},t.readFile=function(e,t,i){if(window.FileReader){var a=new FileReader;if(a.onload=a.onerror=t,i=i||"readAsDataURL",a[i])return a[i](e),a}return!1},"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:e.loadImage=t}(window),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=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);e.blobSlice=t&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},e.metaDataParsers={jpeg:{65505:[]}},e.parseMetaData=function(t,i,a,o){a=a||{},o=o||{};var r=this,n=a.maxMetaDataSize||262144,s=!(window.DataView&&t&&t.size>=12&&"image/jpeg"===t.type&&e.blobSlice);!s&&e.readFile(e.blobSlice.call(t,0,n),function(t){if(t.target.error)return console.log(t.target.error),void i(o);var n,s,l,d,u=t.target.result,c=new DataView(u),f=2,g=c.byteLength-4,h=f;if(65496===c.getUint16(0)){for(;f<g&&(n=c.getUint16(f),n>=65504&&n<=65519||65534===n);){if(s=c.getUint16(f+2)+2,f+s>c.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(l=e.metaDataParsers.jpeg[n])for(d=0;d<l.length;d+=1)l[d].call(r,c,f,s,o,a);f+=s,h=f}!a.disableImageHead&&h>6&&(u.slice?o.imageHead=u.slice(0,h):o.imageHead=new Uint8Array(u).subarray(0,h))}else console.log("Invalid JPEG file: Missing JPEG marker.");i(o)},"readAsArrayBuffer")||i(o)},e.hasMetaOption=function(e){return e.meta};var i=e.transform;e.transform=function(t,a,o,r,n){e.hasMetaOption(a||{})?e.parseMetaData(r,function(n){i.call(e,t,a,o,r,n)},a,n):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";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(e,t,i){var a,o,r;if(!i||t+i>e.byteLength)return void console.log("Invalid Exif data: Invalid thumbnail data.");for(a=[],o=0;o<i;o+=1)r=e.getUint8(t+o),a.push((r<16?"0":"")+r.toString(16));return"data:image/jpeg,%"+a.join("%")},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,r,n){var s,l,d,u,c,f,g=e.exifTagTypes[o];if(!g)return void console.log("Invalid Exif data: Invalid tag type.");if(s=g.size*r,l=s>4?i+t.getUint32(a+8,n):a+8,l+s>t.byteLength)return void console.log("Invalid Exif data: Invalid data offset.");if(1===r)return g.getValue(t,l,n);for(d=[],u=0;u<r;u+=1)d[u]=g.getValue(t,l+u*g.size,n);if(g.ascii){for(c="",u=0;u<d.length&&(f=d[u],"\0"!==f);u+=1)c+=f;return c}return d},e.parseExifTag=function(t,i,a,o,r){var n=t.getUint16(a,o);r.exif[n]=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 r,n,s;if(i+6>e.byteLength)return void console.log("Invalid Exif data: Invalid directory offset.");if(r=e.getUint16(i,a),n=i+2+12*r,n+4>e.byteLength)return void console.log("Invalid Exif data: Invalid directory size.");for(s=0;s<r;s+=1)this.parseExifTag(e,t,i+2+12*s,a,o);return e.getUint32(n,a)},e.parseExifData=function(t,i,a,o,r){if(!r.disableExif){var n,s,l,d=i+10;if(1165519206===t.getUint32(i+4)){if(d+8>t.byteLength)return void console.log("Invalid Exif data: Invalid segment size.");if(0!==t.getUint16(i+8))return void console.log("Invalid Exif data: Missing byte alignment offset.");switch(t.getUint16(d)){case 18761:n=!0;break;case 19789:n=!1;break;default:return void console.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==t.getUint16(d+2,n))return void console.log("Invalid Exif data: Missing TIFF marker.");s=t.getUint32(d+4,n),o.exif=new e.ExifMap,s=e.parseExifTags(t,d,d+s,n,o),s&&!r.disableExifThumbnail&&(l={exif:{}},s=e.parseExifTags(t,d,d+s,n,l),l.exif[513]&&(o.exif.Thumbnail=e.getExifThumbnail(t,d+l.exif[513],l.exif[514]))),o.exif[34665]&&!r.disableExifSub&&e.parseExifTags(t,d,d+o.exif[34665],n,o),o.exif[34853]&&!r.disableExifGps&&e.parseExifTags(t,d,d+o.exif[34853],n,o)}}},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],t&&(i[t]=this.getText(t)));return i}}),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.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.orientation===!0||i.call(e,t)},e.transformCoordinates=function(t,i){a.call(e,t,i);var o=t.getContext("2d"),r=t.width,n=t.height,s=t.style.width,l=t.style.height,d=i.orientation;if(d&&!(d>8))switch(d>4&&(t.width=n,t.height=r,t.style.width=l,t.style.height=s),d){case 2:o.translate(r,0),o.scale(-1,1);break;case 3:o.translate(r,n),o.rotate(Math.PI);break;case 4:o.translate(0,n),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,-n);break;case 7:o.rotate(.5*Math.PI),o.translate(r,-n),o.scale(-1,1);break;case 8:o.rotate(-.5*Math.PI),o.translate(-r,0)}},e.getTransformedOptions=function(t,i,a){var r,n,s=o.call(e,t,i),l=s.orientation;if(l===!0&&a&&a.exif&&(l=a.exif.get("Orientation")),!l||l>8||1===l)return s;r={};for(n in s)s.hasOwnProperty(n)&&(r[n]=s[n]);switch(r.orientation=l,l){case 2:r.left=s.right,r.right=s.left;break;case 3:r.left=s.right,r.top=s.bottom,r.right=s.left,r.bottom=s.top;break;case 4:r.top=s.bottom,r.bottom=s.top;break;case 5:r.left=s.top,r.top=s.left,r.right=s.bottom,r.bottom=s.right;break;case 6:r.left=s.top,r.top=s.right,r.right=s.bottom,r.bottom=s.left;break;case 7:r.left=s.bottom,r.top=s.right,r.right=s.top,r.bottom=s.left;break;case 8:r.left=s.bottom,r.top=s.left,r.right=s.top,r.bottom=s.right}return s.orientation>4&&(r.maxWidth=s.maxHeight,r.maxHeight=s.maxWidth,r.minWidth=s.minHeight,r.minHeight=s.minWidth,r.sourceWidth=s.sourceHeight,r.sourceHeight=s.sourceWidth),r}});
|
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,d){return e.getContext("2d").drawImage(t,i,a,o,n,r,s,l,d),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||v)/v,(d||P)/P);e>1&&(v*=e,P*=e)}function n(){var e=Math.min((r||v)/v,(s||P)/P);e<1&&(v*=e,P*=e)}i=i||{};var r,s,l,d,c,u,f,g,h,m,p,S=document.createElement("canvas"),b=t.getContext||e.hasCanvasOption(i)&&S.getContext,y=t.naturalWidth||t.width,x=t.naturalHeight||t.height,v=y,P=x;if(b&&(f=(i=e.getTransformedOptions(t,i,a)).left||0,g=i.top||0,i.sourceWidth?(c=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(f=y-c-i.right)):c=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),v=c,P=u),r=i.maxWidth,s=i.maxHeight,l=i.minWidth,d=i.minHeight,b&&r&&s&&i.crop?(v=r,P=s,(p=c/u-r/s)<0?(u=s*c/r,void 0===i.top&&void 0===i.bottom&&(g=(x-u)/2)):p>0&&(c=r*u/s,void 0===i.left&&void 0===i.right&&(f=(y-c)/2))):((i.contain||i.cover)&&(l=r=r||l,d=s=s||d),i.cover?(n(),o()):(o(),n())),b){if((h=i.pixelRatio)>1&&(S.style.width=v+"px",S.style.height=P+"px",v*=h,P*=h,S.getContext("2d").scale(h,h)),(m=i.downsamplingRatio)>0&&m<1&&v<c&&P<u)for(;c*m>v;)S.width=c*m,S.height=u*m,e.renderImageToCanvas(S,t,f,g,c,u,0,0,S.width,S.height),f=0,g=0,c=S.width,u=S.height,(t=document.createElement("canvas")).width=c,t.height=u,e.renderImageToCanvas(t,S,0,0,c,u,0,0,c,u);return S.width=v,S.height=P,e.transformCoordinates(S,i),e.renderImageToCanvas(S,t,f,g,c,u,0,0,v,P)}return t.width=v,t.height=P,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:[]}},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,d,c=t.target.result,u=new DataView(c),f=2,g=u.byteLength-4,h=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(d=0;d<l.length;d+=1)l[d].call(n,u,f,s,o,a);h=f+=s}!a.disableImageHead&&h>6&&(c.slice?o.imageHead=c.slice(0,h):o.imageHead=new Uint8Array(c).subarray(0,h))}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-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(e,t,i){var a,o,n;{if(i&&!(t+i>e.byteLength)){for(a=[],o=0;o<i;o+=1)n=e.getUint8(t+o),a.push((n<16?"0":"")+n.toString(16));return"data:image/jpeg,%"+a.join("%")}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,d,c,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(d=[],c=0;c<n;c+=1)d[c]=g.getValue(t,l+c*g.size,r);if(g.ascii){for(u="",c=0;c<d.length&&"\0"!==(f=d[c]);c+=1)u+=f;return u}return d}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,d=i+10;if(1165519206===t.getUint32(i+4))if(d+8>t.byteLength)console.log("Invalid Exif data: Invalid segment size.");else if(0===t.getUint16(i+8)){switch(t.getUint16(d)){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(d+2,r)?(s=t.getUint32(d+4,r),o.exif=new e.ExifMap,(s=e.parseExifTags(t,d,d+s,r,o))&&!n.disableExifThumbnail&&(l={exif:{}},s=e.parseExifTags(t,d,d+s,r,l),l.exif[513]&&(o.exif.Thumbnail=e.getExifThumbnail(t,d+l.exif[513],l.exif[514]))),o.exif[34665]&&!n.disableExifSub&&e.parseExifTags(t,d,d+o.exif[34665],r,o),o.exif[34853]&&!n.disableExifGps&&e.parseExifTags(t,d,d+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-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,d=i.orientation;if(d&&!(d>8))switch(d>4&&(t.width=r,t.height=n,t.style.width=l,t.style.height=s),d){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}});
|
2
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.8.
|
4
|
+
version: 1.8.3
|
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:
|
13
|
+
date: 2018-02-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws_cf_signer
|