junhukang

2

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="description" content="1">
<meta name="keywords" content="1">
<meta name="author" content="1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Age Detection</title>
<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/animate.css">
<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/magnific-popup.css">
<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/font-awesome.min.css">
<!-- MAIN CSS -->
<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/tooplate-style.css">
</head>
<body>
<style type="text/css">
.buttonWrap {
position:relative;
float:left;
overflow:hidden;
cursor:pointer;
background-image:url('http://211.249.50.30:8080/example.jpg');
width:500px;
height:615px;
margin:0 auto;
}
.buttonWrap input {
position:absolute;
margin-left:-10px;
filter:alpha(opacity=0);
opacity:0;
-moz-opacity:0;
cursor:pointer;
width:74px;
height:20px;
margin:0 auto;
}
</style>
<!-- 이미지 미리보기 -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
function getThumbnailPrivew(html, $target) {
if (html.files && html.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$target.css('display', '');
//$target.css('background-image', 'url(\"' + e.target.result + '\")'); // 배경으로 지정시
$target.html('<img src="' + e.target.result + '" border="0" alt="" />');
}
reader.readAsDataURL(html.files[0]);
}
}
</script>
<style>
.filebox label {
display: inline-block;
padding: .5em .75em;
color: #999;
font-size: inherit;
line-height: normal;
vertical-align: middle;
background-color: #fdfdfd;
cursor: pointer;
border: 1px solid #ebebeb;
border-bottom-color: #e2e2e2;
border-radius: .25em;
width:100%;
max-width:100%;
}
.filebox input[type="file"] { /* 파일 필드 숨기기 */
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip:rect(0,0,0,0);
border: 0;
}
</style>
<!-- 나이 측정 API -->
<script type="text/javascript">
function test(){
var params = {
// Request parameters <img src="http://localhost:8080/user/mypic.jpg"></img>
"returnFaceId": "true",
"returnFaceLandmarks": "false",
"returnFaceAttributes": "age,gender",
};
$.ajax({
// NOTE: You must use the same location in your REST call as you used to obtain your subscription keys.
// For example, if you obtained your subscription keys from westus, replace "westcentralus" in the
// URL below with "westus".
url: "https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect?" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Content-Type","application/json");
// NOTE: Replace the "Ocp-Apim-Subscription-Key" value with a valid subscription key.
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","7482803a11e44146a53c4fb6a175d20f");
},
type: "POST",
// Request body.
data: '{"url":"http://211.249.50.30:8080/mypic.jpg"}',
})
.done(function(data) {
alert(JSON.stringify(data));
})
.fail(function(data) {
alert(JSON.stringify(data));
});
}
</script>
<!-- 파일 올리기 -->
<script>
$(document).ready(function() {
$('#uploadForm').submit(function() {
$("#status").empty().text("File is uploading...");
$(this).ajaxSubmit({
error: function(xhr) {
status('Error: ' + xhr.status);
},
success: function(response) {
$("#status").empty().text(response);
console.log(response);
}
});
//Very important line, it disable the page refresh.
return false;
});
});
</script>
<!-- PRE LOADER -->
<div class="preloader">
<div class="spinner">
<span class="spinner-rotate"></span>
</div>
</div>
<!-- HOME SECTION -->
<section id="home" class="parallax-section">
<div class="container">
<div class="row">
<div class="col-md-offset-5 col-md-7 col-sm-12">
<div class="home-thumb">
<h1 class="wow fadeInUp" data-wow-delay="0.4s">Age Dectection</h1>
<p class="wow fadeInUp white-color" data-wow-delay="0.6s">나이를 측정하러 오신 걸 환영합니다. <br/>당신은 사진을 업로드하여 사진에 있는 사람의 나이를 측정할 수 있습니다. <br/>
이 페이지는 Microsoft Face cognitive API를 사용하였으며 <br/>관심이 있으시면 <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/face/overview">Face API</a>링크를 참고하여 주십시오.</p>
<a href="#service" class="wow fadeInUp smoothScroll btn btn-default section-btn" data-wow-delay="1s">Let's Go</a>
</div>
</div>
</div>
</div>
</section>
<!-- SERVICE SECTION -->
<section id="service" class="parallax-section">
<div class="container">
<div class="row">
<div class="wow fadeInUp section-title" data-wow-delay="0.2s">
<!-- SECTION TITLE -->
<h2>자, 이제 나이를 측정하고 싶은 사람의 사진을 <br/>업로드 해주세요!</h2>
</div>
<form id="uploadForm" enctype="multipart/form-data"action="/uploads" method="post">
<input type="file" name="userPhoto" />
<input type="submit" value="Upload Image" name="submit">
<span id = "status"></span>
<button onclick="test()">click</button>
<img src="http://211.249.50.30:8080/mypic.jpg"></img>
</form>
<!--
업로드 생성
<form id="" enctype="multipart/form-data" action="/api/photo" method="post">
<input type="file" name="userPhoto" />
<input type="submit" value="Upload Image" name="submit">
<span id = "status"></span>
</form>
이미지 미리보기
<form name="form" id="form" action="" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="filebox">
<label for="cma_file">사진 인증샷 업로드</label>
<input type="file" name="cma_file" id="cma_file" accept="image/*" capture="camera" onchange="getThumbnailPrivew(this,$('#cma_image'))" />
<br /><br />
<div id="cma_image" style="width:100%;max-width:100%;border:1px solid #000;display:none;"></div>
</div>
</form>
-->
</section>
<!-- FOOTER SECTION -->
<footer>
<div class="container">
<div class="row">
<div class="wow fadeInUp col-md-12 col-sm-12" data-wow-delay="0.8s">
<p class="white-color"> Opensource software programming 2017 Kang Jun Hu </p>
<div class="wow fadeInUp" data-wow-delay="1s">
<ul class="social-icon">
<li><a href="#" class="fa fa-facebook"></a></li>
<li><a href="#" class="fa fa-twitter"></a></li>
<li><a href="#" class="fa fa-instagram"></a></li>
<li><a href="#" class="fa fa-behance"></a></li>
<li><a href="#" class="fa fa-github"></a></li>
</ul>
</div>
</div>
</div>
</footer>
<!-- SCRIPTS -->
<script src="http://211.249.50.30:8080/assets/js/jquery.js"></script>
<script src="http://211.249.50.30:8080/assets/js/bootstrap.min.js"></script>
<script src="http://211.249.50.30:8080/assets/js/jquery.parallax.js"></script>
<script src="http://211.249.50.30:8080/assets/js/smoothscroll.js"></script>
<script src="http://211.249.50.30:8080/assets/js/jquery.magnific-popup.min.js"></script>
<script src="http://211.249.50.30:8080/assets/js/magnific-popup-options.js"></script>
<script src="http://211.249.50.30:8080/assets/js/wow.min.js"></script>
<script src="http://211.249.50.30:8080/assets/js/custom.js"></script>
</body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.51/jquery.form.min.js"></script>
</html>