Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

358
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda