Skip to content

Commit

Permalink
🔨 BASE #281 colocando nome arquivo randomico
Browse files Browse the repository at this point in the history
bjverde committed Dec 6, 2023
1 parent 4bb4a12 commit 5b5c885
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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';
8 changes: 4 additions & 4 deletions appexemplo_v1.0/app/lib/include/FormDin5WebCams.js
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 5b5c885

Please sign in to comment.