-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcloudinary.js
More file actions
50 lines (44 loc) · 1.27 KB
/
cloudinary.js
File metadata and controls
50 lines (44 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// config
if (Meteor.isClient) {
orion.filesystem.providerUpload = function (options, success, failure, progress) {
files = options.fileList;
Cloudinary.upload(files, {
folder: Meteor.settings.public.cloudinary.folder,
}, function (error, result) {
if (error) {
failure(new Meteor.Error('rwatts:orionjs-cloudinary', i18n('filesystem.messages.errorUploading')));
} else {
success(result.url, result);
}
Cloudinary.collection.remove({});
});
Tracker.autorun(function () {
var file = Cloudinary.collection.findOne();
if (file) {
progress(file.percent_uploaded);
}
});
};
orion.filesystem.providerRemove = function (file, success, failure) {
Cloudinary.delete(file.meta.publicId, function (error, result) {
if (error) {
failure(new Meteor.Error('rwatts:orionjs-cloudinary', i18n('filesystem.messages.errorRemoving')));
} else {
success();
}
});
};
}
if (Meteor.isServer) {
Cloudinary.config({
cloud_name: Meteor.settings.private.cloudinary.cloud_name,
api_key: Meteor.settings.private.cloudinary.api_key,
api_secret: Meteor.settings.private.cloudinary.api_secret
});
}
if (Meteor.isClient) {
let cloud_name = Meteor.settings.public.cloudinary.cloud_name;
$.cloudinary.config({
cloud_name: cloud_name
});
}