c# - ASP.NET: resize (height and width) an image uploaded to server -


How can I change the size of an image on the server that I just uploaded? I am using C # with .NET Framework 3.5 SP1.

Thank you!

Try the following method:

  public string ResizeImageAndSave (Intest Width , Int height, string image url, string destPath) {System.Drawing.Image fullSizeImg = System.Drawing.Image.FromFile (imageUrl); Double width width = (dual) full seismogram With / (double) width; Double height RTE = (Dual) Full sysigram. Height / (double) height; Dual ratio = Math Maximum (width, height, height); Int newWidth = (int) (fullSizeImg.Width / ratio); Int Nighth = (Int) (Full Size Img. High / Ratio); // system Drawing Image. GetThumbnailImageAbort Dummy Callback = New System. Dropping Image. GetThumbnailImageAbort (thumbnail callback); System.Drawing.Image thumbNailImg = fullSizeImg.GetThumbnailImage (New Width, newHeight, New System.Dogging ImageGetThumbnailImageAbort (thumbnail callback), IntPtr.Zero); // Date time MyDate = DateTime.Now; // String Mysterrine = Medet Toaster ("ddMMyyhhmmss") + imageUrl.Substring (imageUrl.LastIndexOf (".")); ThumbNailImg.Save (destPath, ImageFormat.Jpeg); ThumbNailImg.Dispose (); Return ""; } Public Child Thumbnail Callback () {Return False; }  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -