protected void btnCreateAllImageSizes_Click(object sender, EventArgs e) { FileTypes ft = new FileTypes(); string[] Folders = Directory.GetDirectories(AppDomain.CurrentDomain.BaseDirectory + @"\Picture"); foreach (var folder in Folders) { string[] filePaths = Directory.GetFiles(folder); foreach (var item in filePaths) { string[] arrPath = item.Split('\\'); string FileType = ft.FindImageTypeInString("." + arrPath[arrPath.Length - 1].Split('.')[1]); if (ft.IsImage(FileType)) { System.Drawing.Image imageContent = System.Drawing.Image.FromFile(item); string FileName = arrPath[arrPath.Length - 1].Split('.')[0]; //if (!Directory.Exists(folder + "\\Middle")) //{ // Directory.CreateDirectory(folder + "\\Middle"); //} if (!Directory.Exists(folder + "\\Small")) { Directory.CreateDirectory(folder + "\\Small"); } //if (!File.Exists(folder + @"\Middle\" + FileName + FileType)) //{ //imageContent.resizeImage(800, null).Save(folder + @"\Middle\" + FileName + FileType); //} if (!File.Exists(folder + @"\Small\" + FileName + FileType)) { imageContent.resizeImage(300, null).Save(folder + @"\Small\" + FileName + FileType); } } } } }