-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathtry_pdf_fetch.html
More file actions
60 lines (57 loc) · 2 KB
/
Copy pathtry_pdf_fetch.html
File metadata and controls
60 lines (57 loc) · 2 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>XYCの去除水印</title>
<script>
function removeWatermark() {
var inputImage = document.getElementById("inputImage");
var resultImage = document.getElementById("resultImage");
var downloadLink = document.getElementById("downloadLink");
var uploadInput = document.getElementById("uploadInput");
var file = uploadInput.files[0];
var reader = new FileReader();
reader.onload = function(e) {
inputImage.src = e.target.result;
}
reader.readAsDataURL(file);
var formData = new FormData();
formData.append('file', file);
fetch('/upload', {
method: 'POST',
body: formData
}).then(function(response) {
return response.text();
}).then(function(message) {
if (message === '文件上传成功') {
fetch('/remove_watermark', {
method: 'GET'
}).then(function(response) {
return response.text();
}).then(function(message) {
if (message === '水印去除成功') {
resultImage.src = '/static/result_image.png';
downloadLink.href = '/download';
downloadLink.style.display = 'block';
}
});
}
});
}
</script>
</head>
<body>
<h1>去除水印</h1>
<input type="file" id="uploadInput">
<br><br>
<button onclick="removeWatermark()">去除水印</button>
<br><br>
<h2>输入图像</h2>
<img id="inputImage" width="400">
<br><br>
<h2>去除水印结果</h2>
<img id="resultImage" width="400">
<br><br>
<a id="downloadLink" style="display: none;">下载去除水印结果</a>
</body>
</html>