我正在使用Plupload作为我的文件上传在一个ASP.NET MVC web应用程序。
测试这个网页应用程序在PC上,使用Chrome,我上传的照片保持旋转照片文件保存在硬盘上。但是当我用电子邮件把相同的照片保存在MAC上时,检查照片在MAC上的旋转是否相同,就像在PC上一样,当上传、使用Safari、使用Plupload时,文件被随机地、不正确地旋转。
此问题发生在Safari 6和8上。
我不知道从哪里开始调试这个问题,我正在寻找从哪里开始调试的建议。
发布于 2015-03-16 21:06:07
我通过查看jpeg文件中的EXIF元数据来修复这个问题,这就是如何在C#中读取图像,我根据可能来自iPhone、iPod Touch和一些安卓设备的几个方向旋转图像:
using (
System.Drawing.Image image = System.Drawing.Image.FromStream(new System.IO.MemoryStream(binaryImagedata))
)
{
//image.Width = EndSheetWidth;
PropertyItem[] properties = image.PropertyItems;
int Orientation = 0;
foreach (PropertyItem p in properties)
{
if (p.Id == 274)
{
Orientation = (int) p.Value[0];
if (Orientation == 6)
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
if (Orientation == 8)
image.RotateFlip(RotateFlipType.Rotate270FlipNone);
break;
}
}
//...more code
}//end usinghttps://stackoverflow.com/questions/28998064
复制相似问题