How to take image snapshot with client side camera

2019-02-03 19:59发布

I have a django web application in which i want give a option to capture the image in the registration form,"the registration can be done from any client system" when ever press the capture image button then client system camera should open and take the image should store in server side folder how can i do this.

I am thinking that camera should open from html page and send the image to server, but I am not able open camera using html code.

I hope some one might have done this if yes please give me sample code.

2条回答
Summer. ? 凉城
2楼-- · 2019-02-03 20:27

You have several options to access client webcam. The easiest way is HTML5. But you can use sveral tools in silverlight and flash plugin.

See how-to-access-webcam-from-html5 and html5-getusermedia-record-webcam-both-audio-and-video

After getting image in page you can send it to server in diffrent ways including JavaScript (with AJAX) or using HTML form element (like file input)

查看更多
冷血范
3楼-- · 2019-02-03 20:36

You can use WebRTC for this; html5rocks.com has a nice tutorial, see especially the example of taking screenshots. To store the image on the server, you'll have to upload it via AJAX.

查看更多
登录 后发表回答