Showing
2 changed files
with
267 additions
and
0 deletions
views/upload_ajax구현못함.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="en"> | ||
3 | +<head> | ||
4 | + | ||
5 | +<meta charset="UTF-8"> | ||
6 | +<meta http-equiv="X-UA-Compatible" content="IE=Edge"> | ||
7 | +<meta name="description" content="1"> | ||
8 | +<meta name="keywords" content="1"> | ||
9 | +<meta name="author" content="1"> | ||
10 | +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
11 | + | ||
12 | +<title>Age Detection</title> | ||
13 | + | ||
14 | +<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/bootstrap.min.css"> | ||
15 | +<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/animate.css"> | ||
16 | +<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/magnific-popup.css"> | ||
17 | +<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/font-awesome.min.css"> | ||
18 | +<!-- MAIN CSS --> | ||
19 | +<link rel="stylesheet" href="http://211.249.50.30:8080/assets/css/tooplate-style.css"> | ||
20 | + | ||
21 | +</head> | ||
22 | + | ||
23 | +<body> | ||
24 | + | ||
25 | +<style type="text/css"> | ||
26 | + .buttonWrap { | ||
27 | + position:relative; | ||
28 | + float:left; | ||
29 | + overflow:hidden; | ||
30 | + cursor:pointer; | ||
31 | + background-image:url('http://211.249.50.30:8080/example.jpg'); | ||
32 | + width:500px; | ||
33 | + height:615px; | ||
34 | + margin:0 auto; | ||
35 | + } | ||
36 | + .buttonWrap input { | ||
37 | + position:absolute; | ||
38 | + margin-left:-10px; | ||
39 | + filter:alpha(opacity=0); | ||
40 | + opacity:0; | ||
41 | + -moz-opacity:0; | ||
42 | + cursor:pointer; | ||
43 | + width:74px; | ||
44 | + height:20px; | ||
45 | + margin:0 auto; | ||
46 | + } | ||
47 | +</style> | ||
48 | +<!-- 이미지 미리보기 --> | ||
49 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | ||
50 | + <script> | ||
51 | + function getThumbnailPrivew(html, $target) { | ||
52 | + if (html.files && html.files[0]) { | ||
53 | + var reader = new FileReader(); | ||
54 | + reader.onload = function (e) { | ||
55 | + $target.css('display', ''); | ||
56 | + //$target.css('background-image', 'url(\"' + e.target.result + '\")'); // 배경으로 지정시 | ||
57 | + $target.html('<img src="' + e.target.result + '" border="0" alt="" />'); | ||
58 | + } | ||
59 | + reader.readAsDataURL(html.files[0]); | ||
60 | + } | ||
61 | + } | ||
62 | + </script> | ||
63 | + <style> | ||
64 | + .filebox label { | ||
65 | + display: inline-block; | ||
66 | + padding: .5em .75em; | ||
67 | + color: #999; | ||
68 | + font-size: inherit; | ||
69 | + line-height: normal; | ||
70 | + vertical-align: middle; | ||
71 | + background-color: #fdfdfd; | ||
72 | + cursor: pointer; | ||
73 | + border: 1px solid #ebebeb; | ||
74 | + border-bottom-color: #e2e2e2; | ||
75 | + border-radius: .25em; | ||
76 | + width:100%; | ||
77 | + max-width:100%; | ||
78 | + } | ||
79 | + .filebox input[type="file"] { /* 파일 필드 숨기기 */ | ||
80 | + position: absolute; | ||
81 | + width: 1px; | ||
82 | + height: 1px; | ||
83 | + padding: 0; | ||
84 | + margin: -1px; | ||
85 | + overflow: hidden; | ||
86 | + clip:rect(0,0,0,0); | ||
87 | + border: 0; | ||
88 | + } | ||
89 | + </style> | ||
90 | + | ||
91 | +<!-- 나이 측정 API --> | ||
92 | +<script type="text/javascript"> | ||
93 | + | ||
94 | + function test(){ | ||
95 | + | ||
96 | + | ||
97 | + | ||
98 | + var params = { | ||
99 | + // Request parameters <img src="http://localhost:8080/user/mypic.jpg"></img> | ||
100 | + "returnFaceId": "true", | ||
101 | + "returnFaceLandmarks": "false", | ||
102 | + "returnFaceAttributes": "age,gender", | ||
103 | + }; | ||
104 | + | ||
105 | + $.ajax({ | ||
106 | + // NOTE: You must use the same location in your REST call as you used to obtain your subscription keys. | ||
107 | + // For example, if you obtained your subscription keys from westus, replace "westcentralus" in the | ||
108 | + // URL below with "westus". | ||
109 | + url: "https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect?" + $.param(params), | ||
110 | + beforeSend: function(xhrObj){ | ||
111 | + // Request headers | ||
112 | + xhrObj.setRequestHeader("Content-Type","application/json"); | ||
113 | + | ||
114 | + // NOTE: Replace the "Ocp-Apim-Subscription-Key" value with a valid subscription key. | ||
115 | + xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","7482803a11e44146a53c4fb6a175d20f"); | ||
116 | + }, | ||
117 | + type: "POST", | ||
118 | + | ||
119 | + | ||
120 | + // Request body. | ||
121 | + data: '{"url":"http://211.249.50.30:8080/mypic.jpg"}', | ||
122 | + }) | ||
123 | + .done(function(data) { | ||
124 | + alert(JSON.stringify(data)); | ||
125 | + }) | ||
126 | + .fail(function(data) { | ||
127 | + alert(JSON.stringify(data)); | ||
128 | + }); | ||
129 | + } | ||
130 | +</script> | ||
131 | + | ||
132 | + | ||
133 | +<!-- 파일 올리기 --> | ||
134 | +<script> | ||
135 | + $(document).ready(function() { | ||
136 | + | ||
137 | + $('#uploadForm').submit(function() { | ||
138 | + $("#status").empty().text("File is uploading..."); | ||
139 | + $(this).ajaxSubmit({ | ||
140 | + | ||
141 | + error: function(xhr) { | ||
142 | + status('Error: ' + xhr.status); | ||
143 | + }, | ||
144 | + | ||
145 | + success: function(response) { | ||
146 | + $("#status").empty().text(response); | ||
147 | + console.log(response); | ||
148 | + } | ||
149 | + }); | ||
150 | + //Very important line, it disable the page refresh. | ||
151 | + return false; | ||
152 | + }); | ||
153 | +}); | ||
154 | +</script> | ||
155 | + | ||
156 | + | ||
157 | +<!-- PRE LOADER --> | ||
158 | +<div class="preloader"> | ||
159 | + <div class="spinner"> | ||
160 | + <span class="spinner-rotate"></span> | ||
161 | + </div> | ||
162 | +</div> | ||
163 | + | ||
164 | + | ||
165 | +<!-- HOME SECTION --> | ||
166 | +<section id="home" class="parallax-section"> | ||
167 | + <div class="container"> | ||
168 | + <div class="row"> | ||
169 | + | ||
170 | + <div class="col-md-offset-5 col-md-7 col-sm-12"> | ||
171 | + <div class="home-thumb"> | ||
172 | + <h1 class="wow fadeInUp" data-wow-delay="0.4s">Age Dectection</h1> | ||
173 | + <p class="wow fadeInUp white-color" data-wow-delay="0.6s">나이를 측정하러 오신 걸 환영합니다. <br/>당신은 사진을 업로드하여 사진에 있는 사람의 나이를 측정할 수 있습니다. <br/> | ||
174 | + 이 페이지는 Microsoft Face cognitive API를 사용하였으며 <br/>관심이 있으시면 <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/face/overview">Face API</a>링크를 참고하여 주십시오.</p> | ||
175 | + <a href="#service" class="wow fadeInUp smoothScroll btn btn-default section-btn" data-wow-delay="1s">Let's Go</a> | ||
176 | + </div> | ||
177 | + </div> | ||
178 | + | ||
179 | + </div> | ||
180 | + </div> | ||
181 | +</section> | ||
182 | + | ||
183 | + | ||
184 | +<!-- SERVICE SECTION --> | ||
185 | +<section id="service" class="parallax-section"> | ||
186 | + <div class="container"> | ||
187 | + <div class="row"> | ||
188 | + | ||
189 | + <div class="wow fadeInUp section-title" data-wow-delay="0.2s"> | ||
190 | + <!-- SECTION TITLE --> | ||
191 | + <h2>자, 이제 나이를 측정하고 싶은 사람의 사진을 <br/>업로드 해주세요!</h2> | ||
192 | + </div> | ||
193 | + | ||
194 | + | ||
195 | + | ||
196 | + <form id="uploadForm" enctype="multipart/form-data"action="/uploads" method="post"> | ||
197 | + <input type="file" name="userPhoto" /> | ||
198 | + <input type="submit" value="Upload Image" name="submit"> | ||
199 | + <span id = "status"></span> | ||
200 | + | ||
201 | + <button onclick="test()">click</button> | ||
202 | + <img src="http://211.249.50.30:8080/mypic.jpg"></img> | ||
203 | + </form> | ||
204 | + | ||
205 | + | ||
206 | + <!-- | ||
207 | + | ||
208 | +업로드 생성 | ||
209 | + <form id="" enctype="multipart/form-data" action="/api/photo" method="post"> | ||
210 | + <input type="file" name="userPhoto" /> | ||
211 | + <input type="submit" value="Upload Image" name="submit"> | ||
212 | + <span id = "status"></span> | ||
213 | + </form> | ||
214 | + | ||
215 | +이미지 미리보기 | ||
216 | + <form name="form" id="form" action="" method="post" enctype="multipart/form-data" autocomplete="off"> | ||
217 | + <div class="filebox"> | ||
218 | + <label for="cma_file">사진 인증샷 업로드</label> | ||
219 | + <input type="file" name="cma_file" id="cma_file" accept="image/*" capture="camera" onchange="getThumbnailPrivew(this,$('#cma_image'))" /> | ||
220 | + <br /><br /> | ||
221 | + <div id="cma_image" style="width:100%;max-width:100%;border:1px solid #000;display:none;"></div> | ||
222 | + </div> | ||
223 | +</form> | ||
224 | + --> | ||
225 | + | ||
226 | + | ||
227 | +</section> | ||
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | ||
232 | +<!-- FOOTER SECTION --> | ||
233 | +<footer> | ||
234 | + <div class="container"> | ||
235 | + <div class="row"> | ||
236 | + | ||
237 | + <div class="wow fadeInUp col-md-12 col-sm-12" data-wow-delay="0.8s"> | ||
238 | + <p class="white-color"> Opensource software programming 2017 Kang Jun Hu </p> | ||
239 | + <div class="wow fadeInUp" data-wow-delay="1s"> | ||
240 | + <ul class="social-icon"> | ||
241 | + <li><a href="#" class="fa fa-facebook"></a></li> | ||
242 | + <li><a href="#" class="fa fa-twitter"></a></li> | ||
243 | + <li><a href="#" class="fa fa-instagram"></a></li> | ||
244 | + <li><a href="#" class="fa fa-behance"></a></li> | ||
245 | + <li><a href="#" class="fa fa-github"></a></li> | ||
246 | + </ul> | ||
247 | + </div> | ||
248 | + </div> | ||
249 | + </div> | ||
250 | +</footer> | ||
251 | + | ||
252 | +<!-- SCRIPTS --> | ||
253 | +<script src="http://211.249.50.30:8080/assets/js/jquery.js"></script> | ||
254 | +<script src="http://211.249.50.30:8080/assets/js/bootstrap.min.js"></script> | ||
255 | +<script src="http://211.249.50.30:8080/assets/js/jquery.parallax.js"></script> | ||
256 | +<script src="http://211.249.50.30:8080/assets/js/smoothscroll.js"></script> | ||
257 | +<script src="http://211.249.50.30:8080/assets/js/jquery.magnific-popup.min.js"></script> | ||
258 | +<script src="http://211.249.50.30:8080/assets/js/magnific-popup-options.js"></script> | ||
259 | +<script src="http://211.249.50.30:8080/assets/js/wow.min.js"></script> | ||
260 | +<script src="http://211.249.50.30:8080/assets/js/custom.js"></script> | ||
261 | + | ||
262 | +</body> | ||
263 | +<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | ||
264 | +<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.51/jquery.form.min.js"></script> | ||
265 | + | ||
266 | + | ||
267 | +</html> |
프로젝트 발표자료 2013104044 강준후.pptx
0 → 100644
No preview for this file type
-
Please register or login to post a comment