Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 上载正在剥离图像元数据MVC5_C#_Asp.net Mvc_Http_Post - Fatal编程技术网

C# 上载正在剥离图像元数据MVC5

C# 上载正在剥离图像元数据MVC5,c#,asp.net-mvc,http,post,C#,Asp.net Mvc,Http,Post,我有一个简单的文件上传,用于在我们的商业应用程序中将图像添加到记录中。问题是,上传文件后,我在我的C控制器中,我没有图像的EXIF数据。我没有做任何特别的事情,只是: HTML tempimg变量不包含原始文件中存在的所有EXIF元数据。EXIF类只是我编写的一个lib,用于执行修复方向等操作。在设置属性之前从azure存储获取属性可能有助于在上载图像时保留EXIF数据 CloudBlockBlob blob = sampleContainer.GetBlockBlobReference(pho

我有一个简单的文件上传,用于在我们的商业应用程序中将图像添加到记录中。问题是,上传文件后,我在我的C控制器中,我没有图像的EXIF数据。我没有做任何特别的事情,只是:

HTML


tempimg变量不包含原始文件中存在的所有EXIF元数据。EXIF类只是我编写的一个lib,用于执行修复方向等操作。

在设置属性之前从azure存储获取属性可能有助于在上载图像时保留EXIF数据

CloudBlockBlob blob = sampleContainer.GetBlockBlobReference(photo.FileName);
blob.FetchAttributes();
blob.Properties.ContentType = "image/jpg";
blob.SetProperties();
在上传之前,还要确保图像包含必要的Exif数据。 在我的例子中,我是通过一个聊天应用程序发送图像的,它实际上从图像中删除了Exif数据。
请在询问之前参考更多信息

,我可以转到在线exif查看器查看我需要的所有字段。我猜ImageTools正在剥离exif数据。@DavidCrowell该方法甚至还没有命中
[HttpPost]
    public ActionResult Upload(HttpPostedFileBase photo, FormCollection items)
    {

        string clientId = items[0].ToString();

        var tempimg = Image.FromStream(photo.InputStream);
        if (ImageTools.DetermineIfImageSizeAboveMax(tempimg))
            tempimg = ImageTools.Resize(tempimg, ImageTools.ImageSize.Large);

        var exif = new EXIF();
        var img = exif.FixOrientation(tempimg);

        var azure = new Azure.Blob.Consumer.StorageConsumer(clientId, Azure.StorageBase.MyApp);
        var tempUri = azure.CacheImage(img, photo.FileName);

        return Json(new { path = tempUri });
    }
CloudBlockBlob blob = sampleContainer.GetBlockBlobReference(photo.FileName);
blob.FetchAttributes();
blob.Properties.ContentType = "image/jpg";
blob.SetProperties();