Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Resizing an image
Message
 
À
13/05/2008 20:52:20
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01316868
Message ID:
01317023
Vues:
14
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform