I wrote this script to create thumbnails. Most of the time it works fine, but once in a while ASP.NET locks the file and I get this error: The process cannot access the file 'my_file.jpg' because it is being used by another process. Anyone know what is going on a a fix?
Sub ResizeImage()
Dim bmpOriginal As New System.Drawing.Bitmap(Server.MapPath("images/crop/" & Request("photo")))
Dim bmpNew As New System.Drawing.Bitmap(bmpOriginal, 100, 100)
Response.ContentType = "image/gif"
bmpNew.Save(Server.MapPath("images/temp/" & Request("photo")), System.Drawing.Imaging.ImageFormat.Jpeg )
System.IO.File.Copy(Server.MapPath("images/temp/" & Request("photo")), Server.MapPath(".images/" & Request("photo")), True)
System.IO.File.Delete(Server.MapPath("images/temp/printads/" & Request("photo")))
bmpOriginal.Dispose()
bmpNew.Dispose()
Response.Redirect ("default.asp?action=done")
End
2007-03-06
05:22:04
·
1 answers
·
asked by
Anonymous