Javascript 铬最终闭合反应
我有一个网站是用React JS为导航器开发的,在我的电脑上工作正常,但在平板电脑上我有一个问题。我实现了一个简单的文件选择器,只对图像进行文件处理。问题发生在我使用相机拍摄照片时,它是设备中的相机应用程序,但它并不总是将照片返回到我的网站,有时导航器关闭,或者有时显示一条消息,说明内存不足,无法完成任务 这个问题大约每拍摄十张照片就会出现一次,听起来像是内存泄漏 我正在React中使用DropzoneComponent加载图像,以下是我的代码: 组成部分:Javascript 铬最终闭合反应,javascript,reactjs,google-chrome,web,dropzone.js,Javascript,Reactjs,Google Chrome,Web,Dropzone.js,我有一个网站是用React JS为导航器开发的,在我的电脑上工作正常,但在平板电脑上我有一个问题。我实现了一个简单的文件选择器,只对图像进行文件处理。问题发生在我使用相机拍摄照片时,它是设备中的相机应用程序,但它并不总是将照片返回到我的网站,有时导航器关闭,或者有时显示一条消息,说明内存不足,无法完成任务 这个问题大约每拍摄十张照片就会出现一次,听起来像是内存泄漏 我正在React中使用DropzoneComponent加载图像,以下是我的代码: 组成部分: import DropzoneCom
import DropzoneComponent from 'react-dropzone-component';
化学需氧量:
当图像被加载时,我会做这些事情来处理图像,但是这个方法没有被调用
addedfile = (file) => {
alert('OLA K ASE')
this.dropzone.removeAllFiles();
Resizer.imageFileResizer(
file, //is the file of the new image that can now be uploaded...
900, // is the maxWidth of the new image
900, // is the maxHeight of the new image
'JPEG', // is the compressFormat of the new image
92, // is the quality of the new image
0, // is the rotatoion of the new image
uri => {
this.setState({ src: uri });
}, // is the callBack function of the new image URI
'base64' // is the output type of the new image
);
}
为了帮助你,你需要分享你的代码,请去做。为了帮助你,你需要分享你的代码,请去做
const djsConfig = {
addRemoveLinks: true,
autoProcessQueue: false,
maxFiles: 1,
maxFilesize: 1,
acceptedFiles: "image/png,image/jpeg",
dictDefaultMessage: 'Drop here the image or select',
dictFileTooBig: 'File is too big',
dictInvalidFileType: 'Invalid file',
};
const componentConfig = {
iconFiletypes: ['.jpg', '.png'],
showFiletypeIcon: true,
postUrl: 'no-url'
};
addedfile = (file) => {
alert('OLA K ASE')
this.dropzone.removeAllFiles();
Resizer.imageFileResizer(
file, //is the file of the new image that can now be uploaded...
900, // is the maxWidth of the new image
900, // is the maxHeight of the new image
'JPEG', // is the compressFormat of the new image
92, // is the quality of the new image
0, // is the rotatoion of the new image
uri => {
this.setState({ src: uri });
}, // is the callBack function of the new image URI
'base64' // is the output type of the new image
);
}