-2

I am trying to resize the image that is being uploaded using FileUpload control in ASP.net using VB.NET

I am using a file upload code:

If FileUpload1.HasFile Then
    Dim theFileName As String = Path.Combine(Server.MapPath("~/Uploads"), newfile)
    FileUpload1.SaveAs(theFileName)
End If

How do I resize the image to width:270px height:307px?

falmp
  • 39,347
  • 3
  • 21
  • 18
Billy Hen
  • 13
  • 8

1 Answers1

1

Well, I hope this help :

Dim bmp As New Bitmap(FileUpload1.PostedFile.InputStream)
Dim newImage = New Bitmap(newWidth, newHeight)
Using g = Graphics.FromImage(newImage)
    g.DrawImage(bmp, 0, 0, newWidth, newHeight)
End Using
Top Systems
  • 951
  • 12
  • 24