Skip to content

Instantly share code, notes, and snippets.

@turibbio
Created March 28, 2015 14:59
Show Gist options
  • Save turibbio/a325f52ace07ab4e685b to your computer and use it in GitHub Desktop.
Save turibbio/a325f52ace07ab4e685b to your computer and use it in GitHub Desktop.
create thumbnails in C#
//Salva la mia foto con dimensioni normali
string myImage = Server.MapPath("~/") + "public/images/" + fuImg.FileName;
fuImg.SaveAs(myImage);
//crea e salva il thumbinail
System.Drawing.Image img = System.Drawing.Image.FromFile(myImage);
System.Drawing.Image.GetThumbnailImageAbort myCallback = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
System.Drawing.Image myThumbnail = img.GetThumbnailImage(65, 65, myCallback, IntPtr.Zero);
myThumbnail.Save(Server.MapPath("~/") + "public/thumbs/" + fuImg.FileName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment