-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathindex.html
74 lines (63 loc) · 2.98 KB
/
index.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Rotate 270 degrees</title>
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
function callService() {
setTimeout(function(){
$('#process').prop('disabled', true);
},0);
var formData = new FormData();
formData.append('input_1', $('#input_1')[0].files[0]);
// console.log($('#input_2')[0].files[0]);
$.ajax({
url: "https://rpc.ssvm.secondstate.io:8081/api/multipart/run/271/rotate_270/bytes",
type: "post",
data : formData,
contentType: false,
processData: false,
xhrFields:{
responseType: 'blob'
},
success: function (data) {
const img_url = URL.createObjectURL(data);
$('#wm_img').prop('src', img_url);
$('#process').prop('disabled', false);
},
error: function(){
alert("Rate limit exceeded");
$('#process').prop('disabled', false);
}
});
return false;
}
</script>
</head>
<body>
<div class="container">
<div style="text-align:center;margin:25px">
<a href="https://www.secondstate.io/"><img style="border:0;" src="https://www.secondstate.io/assets/img/logo.png"></a>
<div style="font-size:90%;color:gray;margin:20px"><a href="https://www.secondstate.io/faas/">Fast, safe, portable and serverless Rust functions as services</a></div>
</div>
<h1>Rotate image 270 degrees</h1>
<form id="draw" enctype="multipart/form-data">
<div class="form-group">
<label for="input_1">Please upload an image file (<a href="rotate_180.png" target="_blank">example</a>) <br /></label>
<p style="font-size:0.5vw;">HHahn, CC BY-SA 3.0, via Wikimedia Commons</p>
<br />
<input type="file" class="form-control-file" id="input_1" name="input_1">
</div>
<button class="btn btn-primary mb-2" id="process" name="process" value="1" onclick="return callService();">Rotate 270</button>
</form>
<div class="jumbotron">
<img id="wm_img" class="img-fluid rounded mx-auto d-block"/>
</div>
</div> <!-- /container -->
</body>
</html>