On the file upload you can get the thumbnail and resize it like so.
VB.NET:
Dim _orgThunbnail As System.Drawing.Image = System.Drawing.Image.FromStream(Request.Files("Thumbnail2_" & i).InputStream) ' used to hold the original image
'your fixed height and width
Dim thumb As New Bitmap(10, 10)
'Create a graphics object
Dim gr_dest As Graphics = Graphics.FromImage(thumb)
' just in case it's a transparent GIF force the bg to white if needed
Dim sb = New SolidBrush(System.Drawing.Color.White)
gr_dest.FillRectangle(sb, 0, 0, thumb.Width, thumb.Height)
'Re-draw the image to the specified height and width
gr_dest.DrawImage(_orgThunbnail, 0, 0, thumb.Width, thumb.Height)
'Save the image
_orgThunbnail.Save(Server.MapPath(upload_dir & newimagename & fileExt), originalimg.RawFormat)
I just wrote this code here and have not tested it, so it may need some tweaking if needed.
C# version
{
System.Drawing.Image _orgThunbnail = System.Drawing.Image.FromStream(Request.Files("Thumbnail2_" + i).InputStream);
// used to hold the original image
//your fixed height and width
Bitmap thumb = new Bitmap(10, 10);
//Create a graphics object
Graphics gr_dest = Graphics.FromImage(thumb);
// just in case it's a transparent GIF force the bg to white if needed
var sb = new SolidBrush(System.Drawing.Color.White);
gr_dest.FillRectangle(sb, 0, 0, thumb.Width, thumb.Height);
//Re-draw the image to the specified height and width
gr_dest.DrawImage(_orgThunbnail, 0, 0, thumb.Width, thumb.Height);
//Save the image
_orgThunbnail.Save(Server.MapPath(upload_dir + newimagename + fileExt), originalimg.RawFormat);
}
Edited by user Tuesday, March 31, 2009 2:56:39 PM(UTC)
| Reason: Not specified