-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudInteract.js
More file actions
99 lines (78 loc) · 2.72 KB
/
cloudInteract.js
File metadata and controls
99 lines (78 loc) · 2.72 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
$(document).ready(function(){
var myWidget = cloudinary.createUploadWidget({
cloudName: 'db1iq1bfj',
uploadPreset: 'um9zevap',
sources: ["local", "dropbox"],
folder: 'Submissions'}, (error, result) => {
if (!error && result && result.event === "success") {
console.log('Done! Here is the image info: ', result.info);
jQuery.ajax({
type: "POST",
url: 'processImage.php',
dataType: 'json',
data: {path: result.info.public_id, functionname: 'addPath'},
success: function (obj) {
if( !('error' in obj) ) {
console.log(obj);
}
else {
console.log(obj);
}
},
async: false
// alert('reached submit');
});
}
}
);
document.getElementById("upload_widget").addEventListener("click", function(){
myWidget.open();
}, false);
$("#runOCR").on("click",function(){
jQuery.ajax({
type: "POST",
url: 'processImage.php',
dataType: 'json',
data: {hw: 2, functionname: 'runOCR'},
success: function (obj) {
if( !('error' in obj) ) {
console.log(obj);
}
else {
console.log(obj);
}
},
async: false
// alert('reached submit');
});
});
var myWidget2 = cloudinary.createUploadWidget({
cloudName: 'db1iq1bfj',
uploadPreset: 'um9zevap',
sources: ["local", "dropbox"],
folder: 'Solutions'}, (error, result) => {
if (!error && result && result.event === "success") {
console.log('Done! Here is the image info: ', result.info);
jQuery.ajax({
type: "POST",
url: 'processImage.php',
dataType: 'json',
data: {path: result.info.public_id, functionname: 'solutionPath'},
success: function (obj) {
if( !('error' in obj) ) {
console.log(obj);
}
else {
console.log(obj);
}
},
async: false
// alert('reached submit');
});
}
}
);
document.getElementById("2upload_widget").addEventListener("click", function(){
myWidget2.open();
}, false);
});