#regionModify the resolution of a specified picture/// <summary> ///Modify the resolution of a specified picture/// </summary> /// <param name= "Filefoldurl" >folder URL</param> /// <param name= "FileName" >file name</param> /// <param name= "FilePath" >file path, with file name</param> /// <param name= "_width" >width of the resolution</param> /// <param name= "_height" >resolution of High</param> Public Static voidUpdate_picture (stringFilefoldurl,stringFileName,stringFilePath,int_width,int_height) { Try { byte[] ZP =load_pictmemory (FilePath); MemoryStream Ms=NewMemoryStream (ZP); System.Drawing.Image img=System.Drawing.Image.FromStream (MS); Bitmap BTP=NewBitmap (IMG, _width, _height); DirectoryInfo DTI=NewDirectoryInfo (Filefoldurl); fileinfo[] FIS=DTI. GetFiles (); stringFILEURL = Filefoldurl +FileName; Btp. Save (FILEURL); } Catch(Exception) {Throw; } } /// <summary> ///gets the byte size of the specified file stream/// </summary> /// <param name= "FilePath" >file path</param> /// <returns>byte[]</returns> Public Static byte[] Load_pictmemory (stringFilePath) { byte[] Pictdata =NULL; FileInfo fi=NewFileInfo (FilePath); if(FI. Exists) {Pictdata=New byte[FI. Length]; FileStream FS=NewFileStream (FilePath, FileMode.Open, FileAccess.ReadWrite); BinaryReader BR=NewBinaryReader (FS); Br. Read (Pictdata,0, Convert.ToInt32 (FI. Length)); Fs. Dispose (); } Else{HttpContext.Current.Response.Write ("<script language= ' javascript ' >alert (' did not find the picture you specified ') </script>"); } returnPictdata; } #endregion
Modify the resolution of a specified picture