Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

357
Vistas
Using Webcam in Ruby on Rails

I have a rails app with a sign-up page, where users fill in a form with their details. I want to add a field for user's picture: rather than uploading it, I want the user to take a picture using their webcam. The picture is supposed to be saved to the disk and the DB to be updated with its name and path.

How can I do this? I know that the storage was previously handled by paperclip but it is nowadays done using Active Storage, but what about using the webcam? googling "ruby gem webcam" and limiting results to the last year has been surprisingly unhelpful, with most results being porn-related.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If you want to use the webcam then you'll need to handle that side of things in JavaScript. You would need to use the getUserMedia API to get access to the camera stream. Once you've got that, you can capture a still by writing frames from the camera into a canvas, then exporting the canvas to an image with Canvas.toDataBlob.

Some browsers expose more access to the camera for capturing images, but you'll still get a blob eventually.

Once you've got that, you can add it to a FormData object and submit to your Rails app at which point Active Storage can take over storing the file.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda