gpt4 book ai didi

image - Flutter image_picker 不保存原点名称

转载 作者:行者123 更新时间:2023-12-04 15:17:02 26 4
gpt4 key购买 nike

关闭。这个问题需要details or clarity .它目前不接受答案。












想改善这个问题吗?通过 editing this post 添加详细信息并澄清问题.

去年关闭。




Improve this question




在我的 flutter 项目中,我使用 image_picker 从我的设备中保存图像。我有一些问题。从图库中选择图像后,它会将其名称更改为其他名称。如何从图像中获取原始名称?

最佳答案

您需要使用 Path Package
添加到 pubspec.yaml:

dependencies:
path: ^1.7.0
试试这个:
fileName = path.basename(imageFile.path);
代码示例:
File _storedImage;
Future<void> _takePicture() async {
final imageFile = await ImagePicker.pickImage(
source: Ienter code heremageSource.camera,
maxWidth: 600);
final fileName = path.basename(imageFile.path);
}

关于image - Flutter image_picker 不保存原点名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64151663/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com