From 5b5c8852acb397c3858a9c1efed0e903d2ad2ff8 Mon Sep 17 00:00:00 2001 From: Bjverde Date: Wed, 6 Dec 2023 16:58:50 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20BASE=20#281=20colocando=20nome?= =?UTF-8?q?=20arquivo=20randomico?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/control/forms/fields/exe_upload_img.php | 2 +- appexemplo_v1.0/app/lib/include/FormDin5WebCams.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appexemplo_v1.0/app/control/forms/fields/exe_upload_img.php b/appexemplo_v1.0/app/control/forms/fields/exe_upload_img.php index dbf29380..0277d6b5 100644 --- a/appexemplo_v1.0/app/control/forms/fields/exe_upload_img.php +++ b/appexemplo_v1.0/app/control/forms/fields/exe_upload_img.php @@ -67,7 +67,7 @@ public function __construct() $btnScreenshot->class = 'btn btn-primary btn-sm'; $btnScreenshot->setLabel('Salvar'); $btnScreenshot->setImage('fa:camera'); - $btnScreenshot->addFunction("fd5WebCamCampiturar('".$idField."')"); + $btnScreenshot->addFunction("fd5VideoCampiturar('".$idField."')"); $divButton = new TElement('div'); $divButton->class = 'fd5DivVideoButton'; diff --git a/appexemplo_v1.0/app/lib/include/FormDin5WebCams.js b/appexemplo_v1.0/app/lib/include/FormDin5WebCams.js index 4ca0a6b2..1a586784 100644 --- a/appexemplo_v1.0/app/lib/include/FormDin5WebCams.js +++ b/appexemplo_v1.0/app/lib/include/FormDin5WebCams.js @@ -89,8 +89,7 @@ function fd5VideoStart(){ console.log(error); }); } - -function fd5WebCamCampiturar(id){ +function fd5VideoCampiturar(id){ let hiddenField = document.querySelector('#'+id); console.log(hiddenField); @@ -100,10 +99,11 @@ function fd5WebCamCampiturar(id){ var context = canvas.getContext('2d'); context.drawImage(video, 0, 0); + var nameFile = 'image' + Math.floor((Math.random() * 1000000) + 1) + '.png'; var link = document.createElement('a'); - link.download= 'foto.png'; - hiddenField.value = 'foto.png'; + link.download= nameFile; + hiddenField.value = nameFile; link.href = canvas.toDataURL(); link.textContent = 'Clique para baixar a imagem'; document.body.appendChild(link);