Server IP : 103.6.199.200 / Your IP : 3.135.202.38 Web Server : Microsoft-IIS/10.0 System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586 User : EMPUSA$ ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Domains/tradepan/youth.trade-panel.com/wwwroot/ |
Upload File : |
<%@ page language="C#" autoeventwireup="true" inherits="Snap, App_Web_7mrvpukg" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <link rel="stylesheet" href="member/styles.css"> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js" type="text/javascript"></script> <script type="text/Javascript" language="Javascript"> function drawShapes() { var canvas = document.getElementById("myCanvas"); var context = canvas.getContext("2d"); context.fillStyle = "Blue"; context.fillRect(0, 0, 200, 200); context.beginPath(); context.lineWidth = "4"; context.strokeStyle = "Green"; context.fillStyle = "Yellow"; context.arc(150, 100, 50, 20, Math.PI * 2, false); context.font = "30px Arial"; context.strokeText("3", 20, 40); context.strokeText("4", 40, 40); context.strokeText("5", 60, 40); context.strokeText("6", 80, 40); context.stroke(); context.fill(); } </script> </head> <body onload="drawShapes()"> <form id="form1" runat="server"> <div> <canvas id="myCanvas" width="200" height="200"></canvas> </div> <div class="container"> <div class="app"> <p>Using Opera Next or Chrome Canary, use this page to take your picture!</p> <!-- Ideally these elements aren't created until it's confirmed that the client supports video/camera, but for the sake of illustrating the elements involved, they are created with markup (not JavaScript) --> <video id="video" width="640" height="480" autoplay></video> <canvas id="canvas" ></canvas> <button id="snap12" class="sexyButton">Snap Photo</button> <p id="error-message"></p> <img id="snap" /> <script> // Put event listeners into place window.addEventListener("DOMContentLoaded", function () { // Grab elements, create settings, etc. var canvas = document.getElementById("canvas"), image = document.querySelector('#snap'), context = canvas.getContext("2d"), video = document.getElementById("video"), videoObj = { "video": true }, errBack = function (error) { console.log("Video capture error: ", error.code); }; navigator.getMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); if(!navigator.getMedia){ displayErrorMessage("Your browser doesn't have support for the navigator.getUserMedia interface."); } else{ // Request the camera. navigator.getMedia( { video: true }, // Success Callback function(stream){ // Create an object URL for the video stream and // set it as src of our HTLM video element. video.src = window.URL.createObjectURL(stream); // Play the video element to start the stream. video.play(); video.onplay = function() { showVideo(); }; }, // Error Callback function(err){ displayErrorMessage("There was an error with accessing the camera stream: " + err.name, err); } ); } // Put video listeners into place // if (navigator.getUserMedia) { // Standard // navigator.getUserMedia(videoObj, function (stream) { // video.src = stream; // video.play(); // }, errBack); // } else if (navigator.webkitGetUserMedia) { // WebKit-prefixed // navigator.webkitGetUserMedia(videoObj, function (stream) { // video.src = window.webkitURL.createObjectURL(stream); // video.play(); // }, errBack); // } function takeSnapshot(){ // Here we're using a trick that involves a hidden canvas element. var error_message = document.querySelector('#error-message'); error_message.innerText = "TR"; var hidden_canvas = document.querySelector('canvas'), context = hidden_canvas.getContext('2d'); var width = video.videoWidth, height = video.videoHeight; if (width && height) { // Setup a canvas with the same dimensions as the video. hidden_canvas.width = width; hidden_canvas.height = height; // Make a copy of the current frame in the video on the canvas. context.drawImage(video, 0, 0, width, height); // Turn the canvas image into a dataURL that can be used as a src for our photo. return hidden_canvas.toDataURL('image/png'); } } // Trigger photo take document.getElementById("snap12").addEventListener("click", function () { context.drawImage(video, 0, 0, 800, 800); // var error_message2 = document.getElementById("snap12"); // e.preventDefault(); // var snap = takeSnapshot(); //error_message2.innerText = snap ; // Show image. // var snap = // image.setAttribute('src', snap); //-- var image1 = document.getElementById("canvas").toDataURL("image/png"); image.setAttribute('src', image1); image1 = image1.replace('data:image/png;base64,', ''); //var image1 = snap.replace('data:image/png;base64,', ''); $.ajax({ type: 'POST', url: 'Snap.aspx/UploadImage', data: '{ "imageData" : "' + image1 + '" }', contentType: 'application/json; charset=utf-8', dataType: 'json', success: function(msg) { alert('Image saved successfully !'); } }); var error_message4 = document.getElementById("snap12"); error_message4.innerText = "TRRR"; //-- }); }, false); // var error_message2 = document.getElementById("snap12"); // error_message2.innerText = "TRRR"; </script> </div> </div> </form> </body> </html>