Graduate

Update flask

<!doctype html>
<title>Web Attendance System Register</title>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Web Attendance System Register</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nanum+Gothic:400,700,800&amp;subset=korean">
<style>
body,h1,h2,h3,h4,h5 {font-family: "Nanum+Gothic", sans-serif}
</style>
<style>body,h1,h2,h3,h4,h5 {font-family: "Nanum+Gothic", sans-serif}</style>
<script type='text/javascript' src="{{url_for('static', filename='js/opencv.js')}}"></script>
<script type='text/javascript' src="{{url_for('static', filename='js/utils.js')}}"></script>
<script type='text/javascript' src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
......@@ -14,16 +13,19 @@ body,h1,h2,h3,h4,h5 {font-family: "Nanum+Gothic", sans-serif}
let tempCanvas = document.createElement("canvas");
function load_cascade()
{
let faceCascadeFile = 'haarcascade_frontalface_default.xml'
let faceCascadeURL = "{{url_for('static', filename='js/haarcascade_frontalface_default.xml')}}"
let utils = new Utils('errorMessage');
alert("shibal");
let faceCascadeFile = 'haarcascade_frontalface_default.xml';
let faceCascadeURL = "{{url_for('static', filename='js/haarcascade_frontalface_default.xml')}}";
let utils = new Utils('errorMessage');
utils.createFileFromUrl(faceCascadeFile, faceCascadeURL, () => {
activate()
alert("shibal");
activate();
});
}
function activate()
{
document.getElementById("myFile").disabled = false;
let fileloader = document.getElementById("fileloader");
fileloader.disabled = false;
}
function detect_face()
......@@ -51,7 +53,8 @@ function detect_face()
}
if (faces.size() == 1)
{
document.getElementById("sender").disabled = false;
let sender = document.getElementById("sender");
sender.disabled = false;
}
else if (faces.size() == 0)
{
......@@ -86,10 +89,22 @@ function submit()
})
}
var loadFile = function(event) {
var reader = new FileReader();
reader.readAsDataURL(event.target.files[0]);
output.onload = function() {
var output = document.getElementById('imagefile');
output.src = URL.createObjectURL(event.target.files[0]);
detect_face()
}
};
</script>
</head>
<body class="w3-light-grey" onload="cv['onRuntimeInitialized']=()=>{ load_cascade() }">
<!-- w3-content defines a container for fixed size centered content,
and is wrapped around the whole page content, except for the footer in this example -->
<div class="w3-content" style="max-width:1400px">
<!-- Header -->
......@@ -103,13 +118,14 @@ and is wrapped around the whole page content, except for the footer in this exam
<div>
학번: <input type="text" name="student_id"><br>
이름: <input type="text" name="student_name"><br><br>
<input type="file" name="file" onchange="loadFile(event)" autocomplete="off" accept="image/jpeg" required disabled>
<input type="file" id="fileloader" name="file" onchange="loadFile(event)" autocomplete="off" accept="image/jpeg" required disabled>
<div>
<img id="imagefile" style="display:none;">
<canvas id="preview"></canvas>
</div>
<input id="sender" type="button" onclick="submit" value="등록" disabled>
</div>
</div>
<script>
var loadFile = function(event) {
var reader = new FileReader();
......@@ -121,5 +137,6 @@ and is wrapped around the whole page content, except for the footer in this exam
}
};
</script>
</div>
</body>
</html>
......