-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera.html
executable file
·116 lines (113 loc) · 4.02 KB
/
camera.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html>
<head>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
#content {
width:640px;
height:550px;
position:absolute;
top:50%;left:50%;
margin:-260px 0px 0px -320px;
}
</style>
<script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script language="JavaScript" src="js/scriptcam.js"></script>
<script language="JavaScript">
$(document).ready(function() {
$("#webcam").scriptcam({
width: 640,
height: 480,
showMicrophoneErrors:false,
onError:onError,
cornerRadius: 0,
cornerColor:'e3e5e2',
onWebcamReady:onWebcamReady,
onPictureAsBase64:base64_tofield_and_image
});
$("#subm").click(base64_tofield);
});
function base64_tofield() {
$('#formfield').val($.scriptcam.getFrameAsBase64());
$('#nom').val($.scriptcam.getFrameAsBase64());
};
function base64_toimage() {
$('#image').attr("src","data:image/png;base64,"+$.scriptcam.getFrameAsBase64());
};
function base64_tofield_and_image(b64) {
$('#formfield').val(b64);
$('#image').attr("src","data:image/png;base64,"+b64);
};
function base64_controller() {
$('#image').attr("src","data:image/png;base64,"+$.scriptcam.getFrameAsBase64());
$('#nom').val($.scriptcam.getFrameAsBase64());
}
function changeCamera() {
$.scriptcam.changeCamera($('#cameraNames').val());
}
function onError(errorId,errorMsg) {
$( "#btn1" ).attr( "disabled", true );
$( "#btn2" ).attr( "disabled", true );
alert(errorMsg);
}
function onWebcamReady(cameraNames,camera,microphoneNames,microphone,volume) {
$.each(cameraNames, function(index, text) {
$('#cameraNames').append( $('<option></option>').val(index).html(text) )
});
$('#cameraNames').val(camera);
}
</script>
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-fixed-top">
<div class="container">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Which MPs Are <span style="color:red">Evil?</span></a>
<div class="nav-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li class="active"><a href="camera.html">Camera</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="nav-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div id="content">
<div>
<div id="webcam">
</div>
<div style="margin:5px;">
<select id="cameraNames" size="1" onChange="changeCamera()" style="width:300px;font-size:10px;height:28px;margin-left:170px;">
</select>
</div>
</div>
<form action="write.php" method="post">
<div style="width:69px;margin:auto;">
<p><button style="margin-top:5px" class="btn btn-small" id="btn2" onclick="base64_controller()">SNAP :-)</button></p>
</div>
</br>
<input style="visibility:hidden" id="nom" type="text" name="image"></input><br>
</form>
</div>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>
</html>