Resize Image with ASP.NET (GetThumbnailImageMethod)

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Call Me.ImageResize("", 220)

    End Sub

    Private Sub ImageResize(ByVal ImageName As String, _
                        ByVal width As Integer)

        Dim myMainImg As New Bitmap("c:\3178.jpg")
        Dim myCallBack As Image.GetThumbnailImageAbort
        Dim nheight As Integer
        nheight = Convert.ToInt32(myMainImg.Height * width / myMainImg.Width)
        myCallBack = New Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
        Dim Thumb As Image
        Thumb = myMainImg.GetThumbnailImage(width, nheight, myCallBack, IntPtr.Zero)
        Thumb.Save("c:\3178_.jpg")


    End Sub

 


    Public Function ThumbnailCallback() As Boolean
        ThumbnailCallback = False
    End Function

Posted by:

No comments posted.

Name :  

Email :  

Comment Below