从数据库中取得照片內容後 ,如何得知图片是横的还是阔的? 从数据库中取得照片內容後 ,如何得知图片是横的还是阔的? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 上传前,就要取得图片的width,height和它的type.之后在显示时,就好控制了. using System.Windows.Forms;using System.Reflection;using System.Drawing;using System.IO;public static Image GetImage(byte[] imageBytes) { MemoryStream ms = new MemoryStream(imageBytes); Image image = Image.FromStream(ms, true); return image; } public static Image GetReducedImage(int Width, int Height, Image ResourceImage) { try { Image ReducedImage; Image.GetThumbnailImageAbort callb = new Image.GetThumbnailImageAbort(ThumbnailCallback); ReducedImage = ResourceImage.GetThumbnailImage(Width, Height, callb, IntPtr.Zero); return ReducedImage; } catch { return null; } } public static bool ThumbnailCallback() { return true; } int fileLength = FileUpload1.PostedFile.ContentLength; //得到文件大小 byte[] fileData = new byte[fileLength]; //创建数组 image = fileData; 错误1无法将型别'byte[]'隐含转换为'System.Drawing.Image' asp.net页面设计时背景图片无法正常显示? 怎么把table 转化成 string ? 一个动软生成类的用法 关于GridView 求 js 代码 gridview显示数据 在aspx如何调用cs中的函数,如何将结果输出在表格内 哪位高手帮我看看这是什么原因引起的错误! 一个很奇怪的问题,有关2003和其他系统的差异,请高手进来帮忙,在线等 关于SQL语句拼写成STRING 后在VB.NET中运行的错误。 ASP.NET access 数据操作 (高分求助)直接在IE浏览器中显示Word的内容
之后在显示时,就好控制了.
using System.Reflection;
using System.Drawing;
using System.IO;public static Image GetImage(byte[] imageBytes)
{
MemoryStream ms = new MemoryStream(imageBytes);
Image image = Image.FromStream(ms, true);
return image;
} public static Image GetReducedImage(int Width, int Height, Image ResourceImage)
{
try
{
Image ReducedImage;
Image.GetThumbnailImageAbort callb = new Image.GetThumbnailImageAbort(ThumbnailCallback);
ReducedImage = ResourceImage.GetThumbnailImage(Width, Height, callb, IntPtr.Zero);
return ReducedImage;
}
catch
{
return null;
}
} public static bool ThumbnailCallback()
{
return true;
}
int fileLength = FileUpload1.PostedFile.ContentLength; //得到文件大小 byte[] fileData = new byte[fileLength]; //创建数组 image = fileData; 错误1无法将型别'byte[]'隐含转换为'System.Drawing.Image'