Flutter 我无法使用本地文件读取带有 readasbytessync 的图像
Flutter I can't read an image with readasbytessync with local file
我不明白为什么直接来自image_picker的图片可以,但从app目录加载的图片不行,我以为是版权问题(我有阅读或记录的权利),但是图片来自同一个文件夹。
不知道我说的清楚没有,有没有人遇到同样的问题?
代码:
print(image);
final fileBytes = image.readAsBytesSync();
print(fileBytes);
Return 刚拍的图:
File: '/data/user/0/com.wallis.env_wallis/app_flutter/1.jpg'
[255, 216, 255, 225, 1, 149, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 10, 1, 59, 0, 2, 0, 0, 0, 22, 0, 0, 0, 134, 1, 0, 0, 4, 0, 0, 0, 1, 0, 0, 2, 128, 1, 16, 0, 2, 0, 0, 0, 6, 0, 0, 0, 156, 1, 1, 0, 4, 0, 0, 0, 1, 0, 0, 1, 224, 1, 15, 0, 2, 0, 0, 0, 7, 0, 0, 0, 162, 1, 14, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 135, 105, 0, 4, 0, 0, 0, 1, 0, 0, 0, 189, 1, 18, 0, 3, 0, 0, 0, 1, 0, 6, 0, 0, 1, 50, 0, 2, 0, 0, 0, 20, 0, 0, 0, 169, 136, 37, 0, 4, 0, 0, 0, 1, 0, 0, 1, 47, 0, 0, 0, 0, 50, 52, 46, 68, 69, 83, 84, 82, 85, 67, 84, 73, 79, 78, 32, 70, 79, 82, 69, 84, 83, 0, 77, 105, 32, 57, 84, 0, 88, 105, 97, 111, 109, 105, 0, 50, 48, 50, 49, 58, 49, 48, 58, 48, 51, 32, 48, 57, 58, 52, 50, 58, 51, 57, 0, 0, 7, 164, 3, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 136, 39, 0, 3, 0, 0, 0, 1, 76, 165, 0, 0, 146, 10, 0, 5, 0, 0, 0, 1, 0, 0, 1, 23, 130, 154, 0, 5, 0, 0, 0, 1, 0, 0, 1, 31, 146, 9, 0, 3, 0, 0, 0, 1, 0, 16, 0, 0, 146, 8, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 130, 157, 0, 5, 0, 0, 0, 1, 0, 0, 1, 39, 0, 0, 0, 0, 0, 0, 18, 162,
Return 文件夹中拍摄的图像:
File: '/data/user/0/com.wallis.env_wallis/app_flutter/485.jpg'
[]
exif文件在多次重命名图像后似乎无法保存,当我发送重命名的图像时它很好但是当我再次重命名图像时出现问题。
所以我改变了重命名图像的时间来解决问题。
我不明白为什么直接来自image_picker的图片可以,但从app目录加载的图片不行,我以为是版权问题(我有阅读或记录的权利),但是图片来自同一个文件夹。 不知道我说的清楚没有,有没有人遇到同样的问题?
代码:
print(image);
final fileBytes = image.readAsBytesSync();
print(fileBytes);
Return 刚拍的图:
File: '/data/user/0/com.wallis.env_wallis/app_flutter/1.jpg'
[255, 216, 255, 225, 1, 149, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 10, 1, 59, 0, 2, 0, 0, 0, 22, 0, 0, 0, 134, 1, 0, 0, 4, 0, 0, 0, 1, 0, 0, 2, 128, 1, 16, 0, 2, 0, 0, 0, 6, 0, 0, 0, 156, 1, 1, 0, 4, 0, 0, 0, 1, 0, 0, 1, 224, 1, 15, 0, 2, 0, 0, 0, 7, 0, 0, 0, 162, 1, 14, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 135, 105, 0, 4, 0, 0, 0, 1, 0, 0, 0, 189, 1, 18, 0, 3, 0, 0, 0, 1, 0, 6, 0, 0, 1, 50, 0, 2, 0, 0, 0, 20, 0, 0, 0, 169, 136, 37, 0, 4, 0, 0, 0, 1, 0, 0, 1, 47, 0, 0, 0, 0, 50, 52, 46, 68, 69, 83, 84, 82, 85, 67, 84, 73, 79, 78, 32, 70, 79, 82, 69, 84, 83, 0, 77, 105, 32, 57, 84, 0, 88, 105, 97, 111, 109, 105, 0, 50, 48, 50, 49, 58, 49, 48, 58, 48, 51, 32, 48, 57, 58, 52, 50, 58, 51, 57, 0, 0, 7, 164, 3, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 136, 39, 0, 3, 0, 0, 0, 1, 76, 165, 0, 0, 146, 10, 0, 5, 0, 0, 0, 1, 0, 0, 1, 23, 130, 154, 0, 5, 0, 0, 0, 1, 0, 0, 1, 31, 146, 9, 0, 3, 0, 0, 0, 1, 0, 16, 0, 0, 146, 8, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 130, 157, 0, 5, 0, 0, 0, 1, 0, 0, 1, 39, 0, 0, 0, 0, 0, 0, 18, 162,
Return 文件夹中拍摄的图像:
File: '/data/user/0/com.wallis.env_wallis/app_flutter/485.jpg'
[]
exif文件在多次重命名图像后似乎无法保存,当我发送重命名的图像时它很好但是当我再次重命名图像时出现问题。 所以我改变了重命名图像的时间来解决问题。