从网络摄像头截图保存图像

时间:2019-08-26 10:48:45

标签: javascript html

我需要将javascript中的网络摄像头屏幕快照中的图像保存到具体文件夹中。所以以后我可以将其插入mysql的数据库中。

<div id="container2">
    <img src="" id="imgID">
    <canvas style="display:none;" id="canvasID"></canvas>
</div>
screenshotButton.onclick = video.onclick = function() {
    canvas.width = video.videoWidth;
    canvas.height = video.videoHeight;
    canvas.getContext('2d').drawImage(video, 0, 0,500,375);
    // Other browsers will fall back to image/png
    img.src = canvas.toDataURL('image/jpg');
};

尝试了很多教程,但没有一个解决问题。

0 个答案:

没有答案
相关问题