470,582 Members | 2,272 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,582 developers. It's quick & easy.

how to SAVE a CROPPED thumbnail of an uploaded image

I have an .aspx page from which users can upload an image. After a
file is uploaded, I also save a 60x60 pixel thumbnail of that image.
Works great.

What I can't seem to do is save a CROPPED thumbnail of that image that
does not stretch the image. Does anyone have code (VB please -- no
C#) that can do that?

Help would be appreciated. Here's what I have:

Dim imgFullSize, imgThumbnail As System.Drawing.Image
imgFullSize = System.Drawing.Image.FromFile(strBasePath &
Response.ContentType = "image/jpeg"
Dim objDummyCallBack As System.Drawing.Image.GetThumbnailImageAbort =
New System.Drawing.Image.GetThumbnailImageAbort( AddressOf
ThumbnailCallBack )
imgThumbnail = imgFullSize.GetThumbnailImage(60, 60, objDummyCallBack,
do while system.io.file.exists(strProposedFilename) = true
RandX = CLng(Int((9999999999 * Rnd()) + 1))
pos = strProposedFilename.lastindexof(".")
strFilenameExtension = strProposedFilename.substring(pos)
strProposedFilename = strProposedFilename.substring(0, pos) & RandX &
dim strFinalThumbnailFileName = strProposedFilename
s1= strFinalThumbnailFileName
pos=s1.lastindexof("\") +1
strFinalThumbnailFileName = s2
imgThumbnail.Save(strBasePath & strFinalThumbnailFileName,
Jul 21 '05 #1
0 955

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michael Satterwhite | last post: by
reply views Thread by Mark | last post: by
4 posts views Thread by moondaddy | last post: by
1 post views Thread by Xah Lee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.