mirror of
https://github.com/hexahigh/games.git
synced 2025-12-11 20:15:38 +01:00
a
This commit is contained in:
parent
495ffd02f4
commit
020fdb2a8f
13
other/logo-detect/index.html
Normal file
13
other/logo-detect/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<script src="index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
0
other/logo-detect/index.js
Normal file
0
other/logo-detect/index.js
Normal file
29
other/logo-detect/test1.html
Normal file
29
other/logo-detect/test1.html
Normal file
@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<body>
|
||||
<div>
|
||||
<input type="file" id="image-input" accept="image/*">
|
||||
<img id="preview"></img>
|
||||
</div>
|
||||
<script>
|
||||
let imgInput = document.getElementById('image-input');
|
||||
imgInput.addEventListener('change', function (e) {
|
||||
if (e.target.files) {
|
||||
let imageFile = e.target.files[0];
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
var img = document.createElement("img");
|
||||
img.onload = function (event) {
|
||||
var canvas = document.createElement("canvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, 300, 300);
|
||||
var dataurl = canvas.toDataURL(imageFile.type);
|
||||
document.getElementById("preview").src = dataurl;
|
||||
}
|
||||
img.src = e.target.result;
|
||||
}
|
||||
reader.readAsDataURL(imageFile);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user