forked from BTE-Germany/map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanoimage.html
89 lines (78 loc) · 3.07 KB
/
panoimage.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!--
~ panoimage.html
~
~ Copyright (c) 2022-2023 Robin Ferch
~ https://robinferch.me
~ This project is released under the MIT license.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>IMAGE</title>
<script src="https://code.jquery.com/jquery-3.6.1.min.js"
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
</head>
<body style="background-color: #052e64; color: white">
<h1 style="color: red; font-family: Commons"><img src="https://bte-germany.de/logo.gif" alt="">BTE GERMANY
PANO Image Creator 4000
</h1>
<p>Website design 30/10 <img src="https://c.tenor.com/AynPukd-dXkAAAAd/dwayne-the-rock.gif" alt="" width="50"></p>
<div style="display: flex; gap: 30px">
<canvas id='img' style='width: 4024px; height: 3018px; display: none' width="4024" height="3018"></canvas>
<div style="background-color: blueviolet; flex: 1; padding: 20px">
<button style="background-color: deeppink" id="selectButton">SELECT IMAGES</button>
<button style="background-color: deeppink" id="exportButton">EXPORT</button>
<a href="" id="imglink"></a>
</div>
</div>
<script type="module">
let canvas = document.getElementById("img");
let ctx = canvas.getContext("2d");
$('#exportButton').click(() => {
let link = document.getElementById('imglink');
link.setAttribute('download', 'pano.png');
link.setAttribute('href', canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"));
link.click();
})
$('#selectButton').click(() => {
let input = document.createElement('input');
input.type = 'file';
input.multiple = true;
input.accept = "image/png";
input.onchange = (e) => {
let filesAmount = input.files.length;
if (filesAmount === 6) {
for (let i = 0; i < input.files.length; i++) {
let img = new Image;
img.onload = function () {
switch (i) {
case 0:
ctx.drawImage(img, 0, 1006);
break;
case 1:
ctx.drawImage(img, 1006, 1006);
break;
case 2:
ctx.drawImage(img, 1006 * 2, 1006);
break;
case 3:
ctx.drawImage(img, 1006 * 3, 1006);
break;
case 4:
ctx.drawImage(img, 1006, 0);
break;
case 5:
ctx.drawImage(img, 1006, 1006 * 2);
break;
}
}
img.src = URL.createObjectURL(input.files[i]);
}
}
}
input.click();
})
</script>
</body>
</html>