Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
usar script JavaScript en controlador laravel

necesito usar este script dentro de un controlador laravel. el guión usa una biblioteca de reconocimiento facial para comparar las caras que están en las fotos. ¿Cómo puedo usar este código dentro de una función pública?

 const imageUpload = document.getElementById('imageUpload') Promise.all([ faceapi.nets.faceRecognitionNet.loadFromUri('/models'), faceapi.nets.faceLandmark68Net.loadFromUri('/models'), faceapi.nets.ssdMobilenetv1.loadFromUri('/models'), faceapi.nets.tinyFaceDetector.loadFromUri('/models') ]).then(start) async function start() { document.body.append('Loaded') imageUpload.addEventListener('change', async () => { image = await faceapi.bufferToImage(imageUpload.files[0]) const descriptions = [] const detections1 = await faceapi.detectAllFaces(image).withFaceLandmarks().withFaceDescriptors(); const faceMatcher = new faceapi.FaceMatcher(detections1, 0.6) var a = 0; const images = []; for (var i = 100; i <= 618; i++) { let image = 0; let img = new Image(); img.src = 'test/' + i + '.jpeg'; image = i + '.jpeg'; const results = await faceapi.detectAllFaces(img).withFaceLandmarks().withFaceDescriptors() results.forEach(fd => { const bestMatch = faceMatcher.findBestMatch(fd.descriptor) if (bestMatch.label == "person 1") { images[a] = image; a++; } }) } }) }

Este proyecto es para funcionar como una API, no quiero que tenga vistas, el usuario solo tendrá una aplicación en reacción nativa haciendo solicitudes a la API de laravel

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

Laravel es php. El intérprete de php no ejecuta javascript. Puede ejecutar JS en un navegador O en un microservicio nodeJS. Si realmente quieres ponerte funky, puedes configurar un navegador sin cabeza en tu servidor.

about 4 years ago · Santiago Gelvez Report

0

No puede ejecutar javascript en el controlador Laravel. Además, esta función se carga desde el DOM, por lo que necesita un documento.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!