The picture taken from the IOS camera is left rotated when showing it in the UI.
I already faced this type of issue and solved by this thread. But in this case, I am saving only the image path
to List.
Camera code:
public async void OpenMyCamera()
{
try
{
List<string> images = new List<string>();
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
await DisplayAlert("Alert", "No camera available.", "Ok");
return;
}
_mediaFile = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
Directory = "Sample",
Name = "test.jpg",
AllowCropping = true
});
if (_mediaFile == null)
return;
//Saving only the path to list.
images.Add(_mediaFile.Path);
MessagingCenter.Send<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelected", images);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Exception:>" + ex);
}
}
I am using FlowListView
for showing the pictures using the following code.
MessagingCenter.Subscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelected", (s, images) =>
{
for (int i = 0; i < images.Count; i++)
{
_images.Add(images[i]);
_images = new ObservableCollection<string>(_images.Distinct());
listItems.FlowItemsSource = _images;
}
});
}
What is the solution for this issue?