Exemple #1
0
 public ActionResult Imagenew()
 {
     var model = new ImageModel()
     {
         Images = Directory.EnumerateFiles(Server.MapPath("~/images_upload/"))
         .Select(fn => "~/images_upload/" + Path.GetFileName(fn))
     };
     return View(model);
 }
Exemple #2
0
 public ActionResult Imagenew(ImageModel model)
 {
     if (ModelState.IsValid)
     {
         string fileName = ShortGuid.NewGuid().ToString();
         string serverPath = Server.MapPath("~");
         string imagesPath = serverPath + "/images_upload";
         string thumbPath = imagesPath + "/images_upload";
         string fullPath = imagesPath + "/images_upload";
         ImageModel.ResizeAndSave(thumbPath, fileName, model.ImageUploaded.InputStream, 80, true);
         ImageModel.ResizeAndSave(fullPath, fileName, model.ImageUploaded.InputStream, 600, true);
     }
     return RedirectToAction("Imagenew");
 }