Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="jquery.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $("#upload_results").hide();
- $("#simpan").hide();
- $("#ambil_photo").click(function(){
- $("#upload_results").show(500);
- $("#simpan").show(500);
- $("#print_area").hide();
- });
- });
- </script>
- </head>
- <body bgcolor="#dedede">
- <form name="f_ktm" method="POST">
- <table border="1" style="border:1px; ">
- </tr>
- <tr><td width="50%" valign="top" align="center">
- <!-- First, include the JPEGCam JavaScript Library -->
- <script type="text/javascript" src="webcam.js"></script>
- <!-- Configure a few settings -->
- <script language="JavaScript">
- webcam.set_api_url( 'capture.php' );
- webcam.set_quality( 100 ); // JPEG quality (1 - 100)
- webcam.set_shutter_sound( true ); // play shutter click sound
- </script>
- <!-- Next, write the movie to the page at 320x240 -->
- <script language="JavaScript">
- document.write( webcam.get_html(220,300) );
- </script>
- <!-- Some buttons for controlling things -->
- <br/><form>
- <input type="button" value="Konfigurasi..." onClick="webcam.configure()">
-
- <input type="button" id="ambil_photo" value="Ambil Photo" onClick="take_snapshot()">
- <input type="submit" id="simpan" name="simpan" value="Simpan" />
- </form>
- <!-- Code to handle the server response (see capture.php) -->
- <script language="JavaScript">
- webcam.set_hook( 'onComplete', 'my_completion_handler' );
- function take_snapshot() {
- // take snapshot and upload to server
- document.getElementById('upload_results').innerHTML = '<p>Menyimpan photo ...</p>';
- webcam.snap();
- }
- function my_completion_handler(msg) {
- // extract URL out of PHP output
- if (msg.match(/(http\:\/\/\S+)/)) {
- var image_url = RegExp.$1;
- // show JPEG image in page
- document.getElementById('upload_results').innerHTML =
- '<img src="' + image_url + '" border="5">'+
- '<br/><br/>Lokasi Photo : <input type="text" name="photo_url" value="'+image_url+'" size="65" readonly="readonly">';
- // reset camera for another shot
- webcam.reset();
- }
- else alert("PHP Error: " + image_url);
- }
- </script>
- </td>
- <td valign="top" width="50%" align="center">
- <div id="upload_results" style="background-color:#dedede;"></div>
- <div id="print_area" style="background-color:#dedede;"><?php if(!empty($_GET['last_id'])){
- echo "<iframe src=\"idcard.php?id=$_GET[last_id]\" width=\"500\" height=\"300\" frameborder=\"no\"></iframe>";
- }
- ?>
- </div>
- </td></tr>
- <tr valign="top">
- <td>
- <table border="0" width="100%">
- <tr valign="top"></tr>
- </table>
- </form>
- <?php
- if(!empty($_POST['simpan'])){
- include('koneksi.php');
- session_start();
- $simpan=mysql_query("insert into foto values('$_SESSION[gae_foto]','$_POST[photo_url]')") or die (mysql_error());
- echo("<META HTTP-EQUIV=Refresh CONTENT=\"0.1;URL=index.php?last_id=$_SESSION[gae_foto]\">");
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement