Firebase WebP图像作为应用程序/八位字节流文件上载。火基/颤振
我正在将图像上载到firebase存储,如果图像类型为webp则将其作为应用程序/八位字节流文件错误地上载到firebase中。Firebase WebP图像作为应用程序/八位字节流文件上载。火基/颤振,firebase,flutter,dart,firebase-storage,Firebase,Flutter,Dart,Firebase Storage,我正在将图像上载到firebase存储,如果图像类型为webp则将其作为应用程序/八位字节流文件错误地上载到firebase中。是否有方法将webp文件上载到firebase?或者在上传之前如何检测webp文件?(请参阅下面的代码片段) 正在上载到Firebase: for (final image in _imageList) { String path = image.path; print(path); final Reference _ref = FirebaseStora
是否有方法将webp文件上载到firebase?或者在上传之前如何检测webp文件?(请参阅下面的代码片段) 正在上载到Firebase:
for (final image in _imageList) {
String path = image.path;
print(path);
final Reference _ref = FirebaseStorage.instance
.ref()
.child("image.path");
UploadTask uploadTask = _ref.putFile(image as i.File);
await uploadTask.whenComplete(() async {
print("***Image Uploaded***");
String image_Links = await _ref.getDownloadURL();
_imageUrls.add(image_Links);
});
}
通过以下方式选择图像:
我已尝试获取图像文件路径,以防止用户选择webp文件:
String baseName = _imageFile.path.split('/').last;
print(baseName);// output - (image_picker1664504931971029294.jpg)
但事实证明,通过ImagePicker
选择的所有文件都转换为“jpg”格式。(并作为原始格式归入firebase)
String baseName = _imageFile.path.split('/').last;
print(baseName);// output - (image_picker1664504931971029294.jpg)