簡體   English   中英

Mvvmcross PictureChooser插件-Droid-圖片方向錯誤

[英]Mvvmcross PictureChooser Plugin - Droid - Picture orientation is wrong

我正在使用以下代碼在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();
    }
}

有什么想法為什么照片在droid上方向錯誤或如何解決問題?

通過此拉取請求https://github.com/MvvmCross/MvvmCross/pull/627來更新MvxPictureChooserTask.cs的版本,從而解決了該問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM