• R/O
  • SSH
  • HTTPS

project-kamata-it: Commit


Commit MetaInfo

Revision12 (tree)
Time2018-10-10 16:52:07
Authorzwzw3844

Log Message

JS_file,PHP_file

Change Summary

Incremental Difference

--- JS/ajax.js (nonexistent)
+++ JS/ajax.js (revision 12)
@@ -0,0 +1,39 @@
1+// ページの一部だけをreloadする方法
2+// Ajaxを使う方法
3+// XMLHttpRequestを使ってAjaxで更新
4+
5+function ajaxUpdate(url, element) {
6+
7+ // urlを加工し、キャッシュされないurlにする。
8+ url = url + '?ver=' + new Date().getTime(); // ?ver= でなんか情報の追加をするらしい
9+
10+ // ajaxオブジェクト生成
11+ var ajax = new XMLHttpRequest;
12+
13+ // ajax通信open
14+ ajax.open('GET', url, true); //'GET'はhttpのメソッド 数百バイト以内ならGET、それ以上大きいならPOST,リクエスト先のurl?,
15+
16+ // ajax返信時の処理
17+ ajax.onload = function () {
18+
19+ // ajax返信から得たHTMLでDOM要素を更新
20+ element.innerHTML = ajax.responseText;
21+ };
22+
23+ // ajax開始
24+ ajax.send(null);
25+}
26+
27+
28+
29+window.addEventListener('load', function () { //loadもイベントハンドラメソッドのオプション的なやつ
30+
31+ var url = "../html/ajax.php";
32+
33+ var div = document.getElementById('ajaxreload'); //SDNcam1のIDであるajax reloadの内容をdivへ格納
34+
35+ setTimeout(function () {
36+ ajaxUpdate(url, div);
37+ }, 5000);
38+
39+});
\ No newline at end of file
--- css/Campage.css (nonexistent)
+++ css/Campage.css (revision 12)
@@ -0,0 +1,158 @@
1+/* メニュー画面用CSS */
2+
3+/*
4+ h1{
5+ color:#ffd800;
6+ font-size: 50px;
7+ font-family:serif;
8+ background-color:#a9a9a9;
9+ }
10+*/
11+
12+img.captIMG {
13+ width: 320px;
14+ height: 320px;
15+ margin-left: 50px;
16+}
17+
18+
19+#TextSize{
20+ font-size:14px;
21+ float: left;
22+}
23+
24+/* 以下、各SDNcam遷移先ページ用CSS */
25+
26+h3{
27+ color:#ffd800;
28+ font-family:serif;
29+ background-color:#a9a9a9;
30+}
31+
32+.Player img{
33+ width: 960px;
34+ height: auto;
35+ float: left;
36+ margin-left: 200px;
37+ margin-top: 50px;
38+}
39+.CaptTag{
40+ float: left;
41+ width: 500px;
42+ height: 540px;
43+ margin-left: 50px;
44+ margin-top: 50px;
45+ background-color: blue;
46+}
47+#CaptTag{
48+ font-size: 18px;
49+ word-break:break-all;
50+}
51+
52+img{
53+ width: 736px;
54+ height: 414px;
55+}
56+
57+#Back2Menu{
58+ margin-left:950px;
59+ font-size: 14px;
60+}
61+#TitleBar{
62+ text-decoration: underline;
63+ font-size: 36px;
64+}
65+
66+.VideoText{
67+ width: 960px;
68+ height: 250px;
69+ margin-left: 200px;
70+ margin-bottom: 50px;
71+ font-size: 24px;
72+ word-wrap: break-word;
73+ background-color:orange;
74+ position: absolute;
75+ bottom: 0;
76+}
77+
78+.DropMenu{
79+ *zoom: 1;
80+ list-style-type: none;
81+ width: 100%;
82+ margin: 5px auto 30px;
83+ padding: 0;
84+}
85+.DropMenu:before, .DropMenu:after{
86+ content: "";
87+ display: table;
88+}
89+.DropMenu:after{
90+ clear: both;
91+}
92+.DropMenu li{
93+ position: relative;
94+ width: 25%;
95+ float: left;
96+ margin: 0;
97+ padding: 0;
98+ text-align: center;
99+}
100+.DropMenu li a{
101+ display: block;
102+ margin: 0;
103+ padding: 15px 0 11px;
104+ background: #8a9b0f;
105+ color: #fff;
106+ font-size: 16px;
107+ line-height: 1;
108+ text-decoration: none;
109+}
110+.DropMenu li ul{
111+ list-style: none;
112+ position: absolute;
113+ z-index: 9999;
114+ top: 100%;
115+ left: 0;
116+ width: 100%;
117+ margin: 0;
118+ padding: 0;
119+}
120+.DropMenu li ul li{
121+ width: 100%;
122+}
123+.DropMenu li ul li a{
124+ padding: 13px 15px;
125+ border-top: 1px solid #7c8c0e;
126+ background: #6e7c0c;
127+ text-align: left;
128+}
129+.DropMenu li:hover > a{
130+ background: #6e7c0c;
131+}
132+.DropMenu li a:hover{
133+ background: #616d0b;
134+}
135+#flip li ul {
136+ visibility: hidden;
137+ perspective: 400px;
138+}
139+#flip li:hover ul{
140+ visibility: visible;
141+}
142+#flip ul li{
143+ transform: rotateY(90deg);
144+ transform-origin: 50% 0;
145+ transition: .3s;
146+}
147+#flip li:hover li{
148+ transform: rotateY(0);
149+}
150+#flip ul li:nth-child(2) {
151+ transition-delay: .1s;
152+}
153+#flip ul li:nth-child(3) {
154+ transition-delay: .2s;
155+}
156+#flip ul li:nth-child(4) {
157+ transition-delay: .3s;
158+}
\ No newline at end of file
--- html/SDNcam1.php (nonexistent)
+++ html/SDNcam1.php (revision 12)
@@ -0,0 +1,72 @@
1+<!DOCTYPE html>
2+<head>
3+ <title>SDNcam1</title>
4+ <link rel="stylesheet" type="text/css" href="../css/Campage.css">
5+ <meta charset="utf-8">
6+ <html lang="ja">
7+ <script type="text/javascript" src="../JS/ajax.js?ver=1.0"></script> //scriptはJSで外部ファイルajaxを呼び出している
8+</head>
9+
10+<body>
11+ <ul id="flip" class="DropMenu">
12+ <li><a href="#">HOME</a>
13+ <ul>
14+ <li><a href="./Campage.html">preview</a></li>
15+ </ul>
16+ </li>
17+
18+ <li><a href="#">CAMERA</a>
19+ <ul>
20+ <li><a href="./SDNcam1.php">SDNCam1</a></li>
21+ <li><a href="./SDNcam2.php">SDNCam2</a></li>
22+ <li><a href="./SDNcam3.php">SDNCam3</a></li>
23+ </ul>
24+ </li>
25+
26+ <li><a href="#">SnapShot</a>
27+ <ul>
28+ <li><a href="http://192.168.240.123:8045/?action=snapshot" download="sample_ss1.jpg">SS001</a></li>
29+ <li><a href="http://192.168.240.123:8047/?action=snapshot" download="sample_ss2.jpg">SS002</a></li>
30+ <li><a href="http://192.168.240.123:8049/?action=snapshot" download="sample_ss3.jpg">SS003</a></li>
31+ </ul>
32+ </li>
33+
34+ <li><a href="#">SS-Log</a>
35+ <ul>
36+ <li><a href="#">Log001</a></li>
37+ <li><a href="#">Log002</a></li>
38+ <li><a href="#">Log003</a></li>
39+ </ul>
40+ </li>
41+ </ul>
42+
43+ <div class="Player">
44+ <!--<span id = CaptTag>a</span><span id = CaptTag>b</span><span id = CaptTag>c</span><span id = CaptTag>d</span>-->
45+ <img src="sample.mp4">
46+
47+ </div>
48+
49+ <div class="CaptTag" id="ajaxreload">
50+ <span id="CaptTag">
51+ <p><u>
52+ <?php
53+ $cmd = 'python gcp_cv.py sample.mp4';
54+ exec($cmd, $analyze);
55+ #var_dump($analyze);
56+ foreach($analyze as $value){
57+ echo $value;
58+ echo " ";
59+ }
60+ ?>
61+ </u></p>
62+ </span>
63+ </div>
64+
65+ <div class="VideoText">
66+ <span id="TitleBar">たいとるがどーんっ!</span>
67+ <p>
68+ このカメラはSDNcam1です。<br>
69+ 720p、30fpsでストリーミング再生が可能です。</p>
70+ </div>
71+</body>
72+</html>
\ No newline at end of file
--- html/ajax.php (nonexistent)
+++ html/ajax.php (revision 12)
@@ -0,0 +1,21 @@
1+<!DOCTYPE html>
2+<head>
3+ <link rel="stylesheet" type="text/css" href="../css/Campage.css">
4+ <meta charset="utf-8">
5+ <html lang="ja">
6+</head>
7+
8+ <div class="ajaxReturn">
9+ <?php
10+ $cmd = 'python gcp_cv.py sample.mp4';
11+ exec($cmd, $analyze);
12+ #var_dump($analyze);
13+ foreach($analyze as $value){
14+ echo $value;
15+ echo " ";
16+ }
17+ ?>
18+ <p class="article">
19+
20+ </p>
21+</div>
\ No newline at end of file
--- html/gcp_cv.py (nonexistent)
+++ html/gcp_cv.py (revision 12)
@@ -0,0 +1,46 @@
1+# this code is graduation production for NIIT-IS15.
2+# please use lower camel case is variable. >>> team member :D
3+# -*- coding: utf-8 -*-
4+#!C:\Python27\python.exe
5+
6+import requests
7+import json
8+import base64
9+import sys
10+args = sys.argv
11+
12+key = "AIzaSyDFllwEjC5EHUeYbUXhEZMj-QnntEwQh1g"
13+#key = "AIzaSyBpqpScxBY9Nvp2qi_NtiUpd4oHjdQepW4"
14+#key = "AIzaSyBMbcwMNCf9LqxHEsYiFKcC-Ws1RMVwOGE"
15+url = 'https://vision.googleapis.com/v1/images:annotate?key='
16+apiAddr = url + key
17+
18+# Loading
19+imgFilePath = args[1]
20+#imgFilePath = "sasa.jpg"
21+img = open(imgFilePath, 'rb')
22+imgByte = img.read()
23+imgContent = base64.b64encode(imgByte)
24+
25+# Request Body of json
26+reqBody = json.dumps({
27+ 'requests': [{
28+ 'image': {
29+ 'content': imgContent
30+ },
31+ 'features': [{
32+ 'type': 'LABEL_DETECTION',
33+ 'maxResults': 10
34+ }]
35+ }]
36+})
37+# exec json
38+res = requests.post(apiAddr, data=reqBody)
39+
40+# Get Image
41+resJson = res.json()
42+labels = resJson["responses"][0]["labelAnnotations"]
43+for value in labels:
44+ print str(value['description'])+","
45+# print str(round(value['score']*100,3))+"%"
46+# respVar.append(value['description'])
\ No newline at end of file
Show on old repository browser