UPDATE:
This is the entire code, which I pretty much copied and pasted.
<!DOCTYPE HTML>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script language="JavaScript" type="text/javascript"></script>
<style>
</style>
</head>
<body>
<script>
Webcam.set({
width: 320,
height: 240,
dest_width: 640,
dest_height: 480,
image_format: 'jpeg',
jpeg_quality: 90,
force_flash: false
});
</script>
<div id="web_camera" style="width:320px; height:240px;"></div>
<div id="cam_result"></div>
<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
document.addEventListener("DOMContentLoaded", function(event) {
Webcam.set({
width: 320,
height: 240,
image_format: 'jpeg',
jpeg_quality: 90
});
Webcam.attach( '#web_camera' );
function take_snapshot() {
// take snapshot and get image data
Webcam.snap( function(data_uri) {
// display results in page
document.getElementById('cam_results').innerHTML =
'<h2>Here is your image:</h2>' +
'<img src="'+data_uri+'"/>';
Webcam.upload( data_uri, 'upload.php', function(code, text) {
// Upload complete!
// 'code' will be the HTTP response code from the server, e.g. 200
// 'text' will be the raw response content
});
} );
}
});
</script>
<a href="javascript:void(take_snapshot())">Take Snapshot</a>
</body>
I'm using this link
http://mycodingtricks.com/javascript/webcam-api/
This one looks a lot better but may be the same thing
http://www.html5rocks.com/en/tutorials/getusermedia/intro/
What I'm concerned about is the data_uri, also the url upload
So the webcam works, shows my face, whatever, but I push this
<a href="javascript:void(take_snapshot())">Take Snapshot</a>
and nothing happens. I see the little grey box at the bottom left saying javascript:void(take_snapshot()) I'm wondering if I'm supposed to put a parameter...
There can be several problems, I am using domain mapping and the folder may be pointed incorrectly or it could be a file permission problem, I did chown with www-data
This is the upload.php as suggested or rather given by the first link
<?php
// be aware of file / directory permissions on your server
move_uploaded_file($_FILES['webcam']['tmp_name'], '/tabdater/uploads/webcam'.md5(time()).rand(383,1000).'.jpg');
?>
I'd appreciate any help.
See Question&Answers more detail:
os