Javascript: 是否可以在网络浏览器中显示照片之前拍摄多张照片?
Javascript: Is it possible to Capture multiple photos before displaying in web browser the photos?
Javascript: 是否可以拍摄照片然后在网络浏览器中显示照片?我正在使用 dropzone.js,但它似乎无法满足我的需求。
我的项目是让移动相机在显示给浏览器之前连续拍摄照片。我得到的是浏览器只拍摄一张照片然后显示
我正在使用类似下面的东西,这将在移动设备上打开相机。
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);
});
并更新 img 元素以包含文件信息
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]);
}
}
已编辑
Javascript: 是否可以拍摄照片然后在网络浏览器中显示照片?我正在使用 dropzone.js,但它似乎无法满足我的需求。
我的项目是让移动相机在显示给浏览器之前连续拍摄照片。我得到的是浏览器只拍摄一张照片然后显示
我正在使用类似下面的东西,这将在移动设备上打开相机。
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);
});
并更新 img 元素以包含文件信息
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]);
}
}
已编辑