【发布时间】:2021-05-10 14:55:23
【问题描述】:
如何将照片保存在图库文件夹中?我正在使用 ImageCropper.Forms.Fix.v2 和 Xam.Media.Plugin
代码运行良好,但保存在以下位置:/data/user/0/com.companyname.projectname/cache/cropped3243.png
我想将它保存在画廊文件夹中。我该怎么做?
protected async void TapGestureRecognizerCommand(object sender, EventArgs e)
{
await CrossMedia.Current.Initialize();
ImageSource TempimageFile = null;
new ImageCropper()
{
PageTitle = "Crop Photo",
AspectRatioX = 3, //
CropShape = ImageCropper.CropShapeType.Rectangle, //Cropt shape
SelectSourceTitle = "Select source", // Pop up Title
TakePhotoTitle = "Take Photo", // Popup - 1st option
PhotoLibraryTitle = "Photo Library", //Popup - 2nd option
Success = (imageFile) =>
{
Device.BeginInvokeOnMainThread(() =>
{
TempimageFile = ImageSource.FromFile(imageFile);
DisplayAlert("test", "te: " + TempimageFile, "OK");
ImageURL.Source = TempimageFile;
});
}
}.Show(this);
}
【问题讨论】:
-
插件中似乎没有执行此操作的选项
-
Android 设备上没有图库文件夹
-
@jason,我只能使用 Xam.Media.Plugin 保存在图库中,但它没有裁剪选项... ImageCropper.Forms.Fix.v2 有裁剪选项但没有保存到图库跨度>
-
知道我该怎么做吗?也许不同的插件?任何参考链接都会有所帮助
-
它是一个开源插件,修改它来做你想做的并提交一个PR
标签: c# android xamarin xamarin.forms xamarin.android