Mvvmcross PictureChooser插件 - Droid - 图片方向错误

时间:2014-03-18 19:39:59

标签: c# android xamarin.android xamarin mvvmcross

我使用以下代码在iOS和Droid上选择一张照片;但是,在Droid上,以纵向拍摄的图像以横向方向保存。在iOS上,图像以正确的方向保存。

Mvx.Resolve<IMvxPictureChooserTask>().TakePicture(2000, 64, CaptureImageStream, () =>
{
    /* don't do anything on cancel */
});

protected virtual void CaptureImageStream(Stream stream)
{
    var fileStore = Mvx.Resolve<IMvxFileStore>();
    const string folderName = "Observation_Photos";
    fileStore.EnsureFolderExists(folderName);

    //get file name
    var fileName = RandomString(10);
    while (fileStore.Exists(string.Format("{0}/{1}.jpg", folderName, fileName)))
    {
        fileName = RandomString(10);
    }

    //get file bytes
    var fileContents = GetBytes(stream);

    //write file
    var fullPath = string.Format("{0}/{1}.jpg", folderName, fileName);
    fileStore.WriteFile(fullPath, fileContents);
}

private static IEnumerable<byte> GetBytes(Stream stream)
{
    using (var memoryStream = new MemoryStream())
    {
        stream.CopyTo(memoryStream);
        return memoryStream.ToArray();
    }
}

为什么照片在机器人上有错误的方向或如何解决问题的任何想法?

1 个答案:

答案 0 :(得分:0)

从此拉取请求https://github.com/MvvmCross/MvvmCross/pull/627更新MvxPictureChooserTask.cs的版本,解决了问题。