472,325 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 software developers and data experts.

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
0 986

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michael Satterwhite | last post by:
I'm having trouble with the functions for resizing a picture uploaded to my server. Consider the following: $jpeg =...
0
by: Mark | last post by:
Hi all, I want to be able to resize an image that a user has uploaded. I have the image upload working as well as the image resize. When I go to...
4
by: moondaddy | last post by:
I have an app where users will upload photos to their shopping cart. When they review their cart I need to include a light weight thumbnail of the...
2
by: NATO24 | last post by:
Hello, I am trying to write a sub routine that I can pass a posted (image) file to. That routine will save the original file, then create a...
0
by: Matt Brelje | last post by:
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...
1
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for...
1
by: dodgeyb | last post by:
Hi there, Trying to allow client to upload image, thumbnail it, and save it into sql table image field. Code compiles & runs but image cannot be...
3
by: neovantage | last post by:
Hey all, i have created image by mixing logo and the original image. It create image and show in the same window. I have done 3 steps for this....
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.