Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to reduce image size and resude image will save to my imaeg folder.i have done to save image but not reduce image is save to my image folder

HOW TO SAVE reduce IMAGE IN MY IMAGE FOLDER IN MVC4..

this is My Code to save this image

` public ActionResult AddProduct(TblProduct ObjProducts) { HttpPostedFileBase File = Request.Files[0]; if (ModelState.IsValid) {

string filename = Path.GetFileName(File.FileName);
string targetPath = Server.MapPath("Images/" + filename);

///save file
string oldImage = File.FileName;
string NewFileName = ObjProducts.ManualP_Id + ".JPG";
string pic = System.IO.Path.GetFileName(NewFileName);
string path = System.IO.Path.Combine(Server.MapPath("~/Images/ProductImg"), NewFileName);
File.SaveAs(path);
ObjProducts.Image =NewFileName;
ObjProducts.IsActive = true;
ObjProducts.IsDelete = false;
ObjProducts.CreatedDate = DateTime.Now;
db.TblProducts.Add(ObjProducts);
db.SaveChanges();
return RedirectToAction("DisplayProduct", "PanelProduct");
}
return View();
}

`

now i want to reduse image size and new image size will save in my web folder
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900