public static object[] GetImage(string path, string fileanme)
{
string filepath = System.Web.HttpContext.Current.Server.MapPath(path);
object[] imgInfo = new object[3];
if (System.IO.File.Exists(filepath + fileanme))
{
System.IO.FileStream fs = new System.IO.FileStream(filepath + fileanme, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(filepath + fileanme);
Stream s = sr.BaseStream;
System.Drawing.Image oImage = System.Drawing.Image.FromStream(s);
imgInfo[0] = s.Length;
imgInfo[1] = oImage.Height;
imgInfo[2] = oImage.Width;
}
else
imgInfo = null;
return imgInfo;
}
c#获得图片的宽、高 和字节数
最新推荐文章于 2024-07-24 13:29:35 发布