如何将图像保存到外部目录-iOS? [英] How to save image to external directory - iOS?

查看:50
本文介绍了如何将图像保存到外部目录-iOS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用flutter获取对外部目录的访问权限(即相机胶卷)并将图像保存在iOS上的外部目录中?以便从照片应用中查看捕获的图像.

how to get access to the external directory i.e to camera roll and save an image in the external directory on iOS using flutter? so that the captured image will be viewed from the photo app.

推荐答案

因此,iOS实际上没有外部目录AFAIK的概念.

So iOS doesn't actually have a notion of an external directory AFAIK.

在将照片或视频保存到相机胶卷或相册方面,有一个插件, flutter_photokit ,将使您能够做到这一点.您需要将照片/视频保存到应用程序文档目录或临时目录中(使用 path_provider ),然后您可以执行以下操作:

In terms of saving photos or videos to camera roll or albums, there is a plugin, flutter_photokit that will allow you to do just that. You would need to save the photo/video to either the application documents directory or temporary directory (using path_provider) and then you can do the following:

FlutterPhotokit.saveToCameraRoll(filePath: '/path/to/photo.jpg');
// OR
FlutterPhotokit.saveToAlbum(filePath: '/path/to/video.mp4', albumName: 'MyAlbum');

免责声明:我是该插件的作者

Disclaimer: I am the author of this plugin

这篇关于如何将图像保存到外部目录-iOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆