467,885 Members | 1,330 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,885 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 &
strFinalFileName)
Response.ContentType = "image/jpeg"
Dim objDummyCallBack As System.Drawing.Image.GetThumbnailImageAbort =
New System.Drawing.Image.GetThumbnailImageAbort( AddressOf
ThumbnailCallBack )
imgThumbnail = imgFullSize.GetThumbnailImage(60, 60, objDummyCallBack,
IntPtr.Zero)
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 &
strFilenameExtension
loop
dim strFinalThumbnailFileName = strProposedFilename
s1= strFinalThumbnailFileName
pos=s1.lastindexof("\") +1
s2=s1.substring(pos)
strFinalThumbnailFileName = s2
imgThumbnail.Save(strBasePath & strFinalThumbnailFileName,
System.Drawing.Imaging.ImageFormat.Jpeg)
Jul 21 '05 #1
  • viewed: 898
Share:

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
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.