コード例 #1
0
        public ActionResult SearchImage(CKEditorModel model)
        {
            _modObj = model;
            var        ddlSelectOptionList = BindImageList(model.SearchTerms);
            JsonResult jResult             = new JsonResult();

            jResult.Data = ddlSelectOptionList;
            return(jResult);
        }
コード例 #2
0
 public string DeleteFolder(CKEditorModel model)
 {
     _modObj = model;
     if (model.DirectoryList != "Root")
     {
         _modObj.ImageFolder = model.DirectoryList;
         Directory.Delete(_modObj.FileImageFolder, true);
     }
     return("true");
 }
コード例 #3
0
        private CKEditorModel GetViewModel(CKEditorModel model)
        {
            ///tranMode = "N" , "U", "L", "V"

            _modObj.ddlDirectoryList = BindDirectoryList();
            _modObj.ddlImageList     = BindImageList();
            _modObj.SearchTerms      = model.SearchTerms;

            return(_modObj);
        }
コード例 #4
0
        public ActionResult CreateFolder(CKEditorModel model)
        {
            _modObj = model;
            string name = UniqueDirectory(_modObj.NewDirectoryName);

            Directory.CreateDirectory(_modObj.FileImageFolderRoot + "\\" + name);
            var        ddlSelectOptionList = BindDirectoryList(name);
            JsonResult jResult             = new JsonResult();

            jResult.Data = ddlSelectOptionList;
            return(jResult);
        }
コード例 #5
0
 public ActionResult ImageBrowser()
 {
     if (TempData["ViewResultForRedirect"] == null)
     {
         CKEditorModel model = new CKEditorModel();
         GetViewModel(model);
         return(View(_modObj));
     }
     else
     {
         _modObj = (CKEditorModel)TempData["ViewResultForRedirect"];
         return(View(_modObj));
     }
 }
コード例 #6
0
        public ActionResult RenameImage(CKEditorModel model)
        {
            _modObj = model;

            _modObj.ImageFolder = (model.DirectoryList == "Root" ? "" : "\\" + model.DirectoryList);
            _modObj.ImageURL    = _modObj.ImageFolder + "\\" + _modObj.ImageList;
            string filename = UniqueFilename(_modObj.NewImageName);

            System.IO.File.Move(_modObj.ImageURL, _modObj.ImageFolder + "\\" + filename);

            var        ddlSelectOptionList = BindImageList(filename);
            JsonResult jResult             = new JsonResult();

            jResult.Data = ddlSelectOptionList;
            return(jResult);
        }
コード例 #7
0
        public string ResizeImage(CKEditorModel model)
        {
            _modObj = model;

            _modObj.ImageFolder = (model.DirectoryList == "Root" ? "" : "\\" + model.DirectoryList);
            _modObj.ImageURL    = _modObj.ImageFolder + "\\" + _modObj.ImageList;

            int width  = Util.Parse <int>(_modObj.ResizeWidth);
            int height = Util.Parse <int>(_modObj.ResizeHeight);

            ImageMedia img = ImageMedia.Create(System.IO.File.ReadAllBytes(_modObj.ImageURL));

            img.Resize(width, height);
            System.IO.File.Delete(_modObj.ImageURL);
            System.IO.File.WriteAllBytes(_modObj.ImageURL, img.ToByteArray());

            return("true");
        }
コード例 #8
0
        public ActionResult ImageBrowser(CKEditorModel model, HttpPostedFileBase UploadedImageFile)
        {
            _modObj             = model;
            _modObj.ImageFolder = (model.DirectoryList == "Root" ? "" : "\\" + model.DirectoryList);


            if (IsImage(UploadedImageFile.FileName))
            {
                string filename = UniqueFilename(UploadedImageFile.FileName);
                UploadedImageFile.SaveAs(_modObj.FileImageFolder + "\\" + filename);

                //byte[] data = ImageMedia.Create(UploadedImageFile.ContentLength).Resize(960, null).ToByteArray();
                //FileStream file = System.IO.File.Create(_modObj.FileImageFolder + filename);
                //file.Write(data, 0, data.Length);
                //file.Close();


                _modObj.ImageList = filename;
            }
            _modObj.ddlImageList              = BindImageList();
            _modObj.ddlDirectoryList          = BindDirectoryList();
            TempData["ViewResultForRedirect"] = _modObj;
            return(RedirectToAction("ImageBrowser"));
        }
コード例 #9
0
 public string DeleteImage(CKEditorModel model)
 {
     _modObj = model;
     System.IO.File.Delete(_modObj.FileImageFolder + _modObj.ImageList);
     return("true");
 }