我在ASP.NET MVC Web应用程序中使用Plupload作为我的文件上传器。
在PC上测试此网络应用程序,使用Chrome,我上传的照片会保存保存在硬盘上的照片文件的旋转。但是,当我通过电子邮件发送相同的照片并将其保存在MAC上时,检查MAC上的照片旋转是否相同,就像在PC上一样,上传时,使用Safari,使用Plupload,文件随机旋转不正确。
Safari 6和8上会出现此问题。
我不知道从哪里开始调试此问题,我正在寻找有关从哪里开始调试的建议。
答案 0 :(得分:2)
我通过查看jpeg文件中的EXIF元数据修复此问题,这是如何在C#中阅读,我根据可能来自iPhone,iPod Touch和某些Android设备的几个方向旋转图像:
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 using