简体   繁体   中英

Javascript: Is it possible to Capture multiple photos before displaying in web browser the photos?

Javascript: Is it possible to Capture photos then displaying in web browser the photos? I am using dropzone.js but it seems it can't do what I need.

My project is for the mobile camera to capture photos continuously before displaying to the browser.. what i'm getting is that the browser is only taking one picture then displaying

I'm using something like below, this will open the camera on mobile.

HTML

<input type="file" id="story_avatar" capture="camera" accept="image/*"/>
<img src="empty.png" id="image-item" />

JS

$('#story_avatar').change(function() { // this is the file input
    readURL(this);
});

and update an img element to contains the file info

function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function (e) {
            $('#image-item').attr('src', e.target.result); //img element
        }
        reader.readAsDataURL(input.files[0]);
    }
}

edited

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM