请大家来看看我的这段制作缩略图代码是哪错了~~~
turan 2004-07-17 01:30:27 这段代码是我从网上的一段程序里面分离出来的。当我运行整个程序的时候很正常,但是一旦运行这些代码,错误就出在
image=System.Drawing.Image.FromFile(Server.MapPath("photolib\")&filename)
这一句上面。本人对Asp.net了解不深,大家帮我看看为什么会这样?
其中,变量filename是从上一个页面的Session中取的值。
在这里先谢谢各位啦~~
<script language="VB" runat="server">
Dim image,anewimage As System.Drawing.Image
dim width,height,newwidth,newheight as integer
Dim callb As System.Drawing.Image.GetThumbnailImageAbort
image=System.Drawing.Image.FromFile(Server.MapPath("photolib\")&filename)
width=image.Width
height=image.height
if width>height then
newwidth=120
newheight=image.height/image.Width*newwidth
else
newheight=120
newwidth=image.Width/image.height*newheight
end if
aNewImage=image.GetThumbnailImage(newwidth,newheight,callb,new System.IntPtr())
aNewImage.Save(Server.MapPath("photo_s\")&filename)
image.Dispose()
</script>