private string UploadImage(int id) { string returns = ""; var ext = Path.GetExtension(upHinhanh.FileName).ToLower(); if (ext.Equals(".jpg") || ext.Equals(".png") || ext.Equals(".jpeg")) { var filename = UnicodeUtility.UrlRewriting(txtTenTin.Text); var path = Server.MapPath("~/images/news/" + id / 200 + "/" + id + "/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } upHinhanh.SaveAs(path + filename + ext); ResizeImage.ImageCrop(upHinhanh.FileBytes, path + "168.109." + filename + ext, 168, 109, 60); returns = filename + ext; } return(returns); }
private string UploadImage(int id) { string returns = ""; var ext = Path.GetExtension(Upload_Images.FileName).ToLower(); if (ext.Equals(".jpg") || ext.Equals(".png") || ext.Equals(".jpeg")) { var filename = UnicodeUtility.UrlRewriting(TB_Name.Text); var path = Server.MapPath("~/images/product/" + id / 200 + "/" + id + "/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } Upload_Images.SaveAs(path + filename + ext); ResizeImage.ImageCrop(Upload_Images.FileBytes, path + "208.129." + filename + ext, 208, 129, 60); ResizeImage.ImageCrop(Upload_Images.FileBytes, path + "256.158." + filename + ext, 256, 158, 60); returns = filename + ext; } return(returns); }