Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resizing an image
Message
 
To
13/05/2008 20:52:20
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01316868
Message ID:
01317023
Views:
13
This message has been marked as the solution to the initial question of the thread.
>When an image is received on a Web server, I need to make another copy of it in a small picture. What would be the best approach to do to obtain that?

Something like this would work (you'll obviously want to verify the image types, add some error/exception handling). I'm also assuming you're using the FileUpload control. This code could go in the Click event of your "Upload" button.
System.Drawing.Image img = System.Drawing.Image.FromStream(this.FileUpload1.PostedFile.InputStream);
System.Drawing.Image thumb = img.GetThumbnailImage(100, 100, null, IntPtr.Zero);
thumb.Save(@"C:\Sample.jpg");
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform