Answer the question
In order to leave comments, you need to log in
How to send an image to the server?
Maybe the question is super stupid, but I still do not understand.
Look, I'm running the index.js server.
Next, I have a path to the page (I use the template engine and express)
app.get('/camera', function(req, res) {
res.render('camera');
});
<div class="app">
<video id="camera-stream"></video>
<img id="snap">
<p id="error-message"></p>
<div class="controls">
<a href="#" id="take-photo" title="Take Photo"><i class="material-icons">camera_alt</i></a>
</div>
<canvas id="simple_sketch"></canvas>
</div>
function takeSnapshot(){
var hidden_canvas = document.querySelector('canvas'),
context = hidden_canvas.getContext('2d');
var width = video.videoWidth,
height = video.videoHeight;
if (width && height) {
hidden_canvas.width = width;
hidden_canvas.height = height;
context.drawImage(video, 0, 0, width, height);
return hidden_canvas.toDataURL('image/png');
}
}
var cloudinary = require('cloudinary');
var image = "Сюда нужно кидать фотки каждые 5 секунд";
cloudinary.uploader.upload(image, function(result) {
console.log(result)
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question