如何压缩扑来上传图像?
如何压缩 flutter 上传的图像?
现在,我已经使用了这种方法,但是我需要压缩图像文件然后上传到firestore。
SimpleDialogOption(
padding: const EdgeInsets.all(20),
child: const Text('Take a photo'),
onPressed: () async {
Navigator.of(context).pop();
Uint8List file = await pickImage(ImageSource.camera);
setState(() {
_file = file;
});
},
),
我见过类似的方法;但不知道如何改变它。
File _image;
Future getImage() async {
var image = await ImagePicker.pickImage(
source: ImageSource.gallery,
imageQuality: 25,
);
setState(() {
_image = image;
});
}
how can do compress upload image from flutter?
Now, I had used this methods, but I needs to compress image file then upload to firestore.
SimpleDialogOption(
padding: const EdgeInsets.all(20),
child: const Text('Take a photo'),
onPressed: () async {
Navigator.of(context).pop();
Uint8List file = await pickImage(ImageSource.camera);
setState(() {
_file = file;
});
},
),
I had saw similar this methods; but no idea how to change it.
File _image;
Future getImage() async {
var image = await ImagePicker.pickImage(
source: ImageSource.gallery,
imageQuality: 25,
);
setState(() {
_image = image;
});
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅下面的代码示例,以选择多个图像并压缩所有采摘的图像。
我使用了以下包
images_picker: ^1.2.4
flutter_image_compress: ^0.7.0
Please refer to below code example of picking multiple images and compress all the picked images.
I have used these following packages
images_picker: ^1.2.4
flutter_image_compress: ^0.7.0