image upload by webcam in php
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<input type="text" name="myname" id="myname">
<input type="submit" name="send" id="send">
</form>
<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
document.write( webcam.get_html(320, 240) );
</script>
<form>
<input type=button value="Configure..." onClick="webcam.configure()">
<input type=button name="img" value="Take Snapshot"
onClick="take_snapshot()">
</form>
<script language="JavaScript">
document.write( webcam.get_html(320, 240) );
</script>
<script language="JavaScript">
webcam.set_api_url( 'test.php' );
webcam.set_quality( 90 ); // JPEG quality (1 - 100)
webcam.set_shutter_sound( true ); // play shutter click sound
webcam.set_hook( 'onComplete', 'my_completion_handler' );
function take_snapshot(){
// take snapshot and upload to server
document.getElementById('upload_results').innerHTML =
'<h1>Uploading...</h1>';
webcam.snap();
}
function my_completion_handler(msg) {
// extract URL out of PHP output
if (msg.match(/(http\:\/\/\S+)/)) {
// show JPEG image in page
document.getElementById('upload_results').innerHTML
='<h1>Upload Successful!</h1>';
// reset camera for another shot
webcam.reset();
}
else {alert("PHP Error: " + msg);
}
</script>
<div id="upload_results" style="background-color:#eee;"></div>
I am working in the php language , I am trying to upload the image from
webcam and want to save it on my pc , webcam is working fine it is opening
the webcom but i click on the take_snapshot , it does nothing ........I
having a problem in understanding the java script part and what is
happening when take_snapshot button is clicked
No comments:
Post a Comment