Link to home
Start Free TrialLog in
Avatar of soulcode
soulcode

asked on

How do I resize the height/width of an image in ratio after upload !!


Hi People,

Im using the following control in asp.net to allow users to upload an image to the server::
<INPUT id="ctlLogoFile" type="file" name="Pic" runat="server" size="15">

I want to be able to take the image, resize it in ratio so it will fit within 200x200 bounds, then save it on the server as a file.

I have code to save the image to the server, just no code to resize image.  Its similar to creating a thumbnail image, just making sure the height and width ratio stays in tact.

Help me!  :o(   i've bee trying to find a solution for this for weeks!!

Avatar of ihenry
ihenry

Try this article,

Uploading, Determining Size, Width and Height and Resizing Image Files with ASP.NET
http://www.stardeveloper.com/articles/display.html?article=2003040501&page=1
ASKER CERTIFIED SOLUTION
Avatar of AerosSaga
AerosSaga

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
call it like so:

Dim IncomingFile As IO.FileInfo
        Dim ImageSource, PriceValue As String
        Dim ImageResizer As New ResizeImage(True, 400, 300)

        ImageResizer.ThumbX = 100
        ImageResizer.ThumbY = 100

        If ImageSrc.PostedFile.ContentLength <> 0 Then
            IncomingFile = New IO.FileInfo(Request.Files(0).FileName)
            IncomingFile = New IO.FileInfo(Server.MapPath("~/Pictures/Products/") & IncomingFile.Name)
            Request.Files(0).SaveAs(IncomingFile.FullName)
            ImageSource = ImageResizer.ResizeImage(IncomingFile.FullName)
        End If
Avatar of soulcode

ASKER


AerosSaga... you rock!  worked out of the box (almost)  :-)

hehe thank you, thank you

Aeros