Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Capture Web camera image using WebcamJS and PHP - Theonlytutorials.com</title>
  6. <style type="text/css">
  7. body { font-family: Helvetica, sans-serif; }
  8. h2, h3 { margin-top:0; }
  9. form { margin-top: 15px; }
  10. form > input { margin-right: 15px; }
  11. #results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
  12. </style>
  13. </head>
  14. <body>
  15. <div id="results">Your captured image will appear here...</div>
  16. <h1>Capture Web camera image using WebcamJS and PHP - Theonlytutorials.com</h1>
  17. <h3>Demonstrates simple 600x460 capture &amp; display</h3>
  18. <div id="my_camera"></div>
  19. <!-- First, include the Webcam.js JavaScript Library -->
  20. <script type="text/javascript" src="/lib/javascript/webcam/webcam.js"></script>
  21. <!-- Configure a few settings and attach camera -->
  22. <script language="JavaScript">
  23. Webcam.set({
  24. width: 600,
  25. height: 460,
  26. image_format: 'jpeg',
  27. jpeg_quality: 90
  28. });
  29. Webcam.attach( '#my_camera' );
  30. </script>
  31. <!-- A button for taking snaps -->
  32. <form>
  33. <input type=button value="Take Snapshot" onClick="take_snapshot()">
  34. </form>
  35. <!-- Code to handle taking the snapshot and displaying it locally -->
  36. <script language="JavaScript">
  37. function take_snapshot() {
  38. // take snapshot and get image data
  39. Webcam.snap( function(data_uri) {
  40. // display results in page
  41. Webcam.upload( data_uri, 'saveimage.php', function(code, text) {
  42. document.getElementById('results').innerHTML =
  43. '<h2>Here is your image:</h2>' +
  44. '<img src="'+text+'"/>';
  45. } );
  46. } );
  47. }
  48. </script>
  49. </body>
  50. </html>