示例#1
0
        public ActionResult PhotoRemove(string[] fileNames, PathHelper.Images.Type ImageType, bool NotLiveImg)
        {
            if (session.LastUploadedFile != "")
            {
                ViewBag.savedFileName = session.LastUploadedFile;

                this.ImageType  = ImageType;
                this.NotLiveImg = NotLiveImg;

                DeleteImage(FullPathPhysc(Parameter.ImageSizeNaming.Original));
                DeleteImage(FullPathPhysc(Parameter.ImageSizeNaming.Default));
                DeleteImage(FullPathPhysc(Parameter.ImageSizeNaming.Preview));

                ViewBag.savedFileName = session.LastUploadedFile = "";
            }
            return(Json(new { }, "text/plain"));
        }
示例#2
0
        public ActionResult PhotoUpload(HttpPostedFileBase FileUpload, PathHelper.Images.Type ImageType, bool ResizeDefault, int ResizeDefaultW, int ResizeDefaultH, bool NotLiveImg)
        {
            this.ImageType  = ImageType;
            this.NotLiveImg = NotLiveImg;

            ViewBag.savedFileName = Com.General.ProjectUtil.GenerateImageName(Path.GetFileName(FileUpload.FileName));

            session.LastUploadedFile = ViewBag.savedFileName;

            FileUpload.SaveAs(FullPathPhysc(Parameter.ImageSizeNaming.Original));

            ImageResizePreview();

            if (ResizeDefault)
            {
                ImageResize(ResizeDefaultW, ResizeDefaultH, Parameter.ImageSizeNaming.Default);
            }

            var savedBig = (ResizeDefault) ? FullPath(Parameter.ImageSizeNaming.Default) : FullPath(Parameter.ImageSizeNaming.Original);

            return(Json(new { savedFileName = ViewBag.savedFileName, savedBig = savedBig, pathPreview = FullPath(Parameter.ImageSizeNaming.Preview) }, "text/plain"));
        }