System.Drawing.Image image = new Bitmap("e:\show.jpg"); ===> System.Drawing.Image image = new Bitmap(@"e:\show.jpg");or System.Drawing.Image image = new Bitmap(@"e:\show.bmp"); make sure e:\show.jpg or e:\show.bmp exists and you give ASPNET or Everyone read permissions on the file
Graphics g=Graphics.FromImage(pThumbnail);
g.DrawImage(pThumbnail,10,10, pThumbnail.Width, pThumbnail.Height);
pThumbnail.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
谢谢你的帮助,我试运行了一下,一按按钮,就说:使用了无效参数。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentException: 使用了无效参数。改过后的是这样的:<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing" %><html><script language="C#" runat="server">
public void add (Object sender, EventArgs e) {System.Drawing.Image image = new Bitmap("e:\show.jpg");
System.Drawing.Image pThumbnail = image.GetThumbnailImage(100, 100, null, new IntPtr());
Graphics g=Graphics.FromImage(pThumbnail);
g.DrawImage(pThumbnail,10,10, pThumbnail.Width, pThumbnail.Height);
pThumbnail.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg); }
public static bool ThumbnailCallback()
{
return false;
}</script><body bgcolor="ffffff" style="margin:0,0,0,0"><form method=post runat=server> <input type="submit" value="submit" OnServerClick="add" runat="server"/>
</form>
</body>
</html>我不太懂这个,请问怎么办?
===>
System.Drawing.Image image = new Bitmap(@"e:\show.jpg");or
System.Drawing.Image image = new Bitmap(@"e:\show.bmp");
make sure e:\show.jpg or e:\show.bmp exists and you give ASPNET or Everyone read permissions on the file