If btnBrowse.HasFile Then
Dim fileName As String = ""
dim imgHeight как целое число = 25
dim imgWeight как целое число = 25
fileName = Path.GetRandomFileName.Replace(".", " ") & ".png"
lblImagePath.Text = ConfigurationManager.AppSettings("imgPath").ToString() & fileName
If File.Exists(Server.MapPath("objectimages") & "/" & btnBrowse.FileName) Then
File.Delete(Server.MapPath("objectimages") & "/" & btnBrowse.FileName)
End If
btnBrowse.SaveAs(Server.MapPath("objectimages") & "/" & btnBrowse.FileName)
Dim image As Image = image.FromFile(Server.MapPath("objectimages") & "/" & btnBrowse.FileName)
Dim thumbnailImage As Image = image.GetThumbnailImage(imgHeight , imgWeight , Nothing, IntPtr.Zero)
' Response.ContentType = "image/Jpeg/png/jpg"
'thumbnailImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
' btnBrowse.SaveAs(Server.MapPath("objectimages") & "/" & btnBrowse.FileName)
Dim bmp As Bitmap = CType(thumbnailImage, Bitmap)
bmp.Save(Server.MapPath("objectimages") & "/" & fileName)
bmp.Dispose()
End If