Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
2240 Points
531 Posts
Mar 09, 2007 06:52 PM|LINK
check this
// Get the path of the original Image string displayedImg = Server.MapPath("~") + "/Testing.jpg";
// Get the path of the Thumb folder string displayedImgThumb = Server.MapPath("~") + "/Thumb/"; // Get the original image file name string imgFileName = System.IO.Path.GetFileName(displayedImg); // Load original image System.Drawing.Image myimg = System.Drawing.Image.FromFile(displayedImg);
// Get the thumbnail 100 X 100 px myimg = myimg.GetThumbnailImage(100, 100, null, IntPtr.Zero); // Save the new thumbnail image myimg.Save(displayedImgThumb + imgFileName, myimg.RawFormat);
Hope this helps
Ramzi.Aynati
Contributor
2240 Points
531 Posts
Re: Resize Images on upload
Mar 09, 2007 06:52 PM|LINK
check this
// Get the path of the original Image
string displayedImg = Server.MapPath("~") + "/Testing.jpg";
// Get the path of the Thumb folder
string displayedImgThumb = Server.MapPath("~") + "/Thumb/";
// Get the original image file name
string imgFileName = System.IO.Path.GetFileName(displayedImg);
// Load original image
System.Drawing.Image myimg = System.Drawing.Image.FromFile(displayedImg);
// Get the thumbnail 100 X 100 px
myimg = myimg.GetThumbnailImage(100, 100, null, IntPtr.Zero);
// Save the new thumbnail image
myimg.Save(displayedImgThumb + imgFileName, myimg.RawFormat);
Hope this helps
Ramzi
--------------------------------------------
Dont Forget to mark the post as answered once replied.