Exemple #1
0
        public FileEntity UploadCutImage(string inputFileName, string outputFileName, string fileFolder, string filePhysicalPath, int toWidth, int toHeight, int cropWidth, int cropHeight, int x, int y)
        {
            string fileType = "jpg";

            FileEntity file = new FileEntity();

            try
            {
                string filePath = filePhysicalPath + "/";
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                file.DisplayName = Path.GetFileName(outputFileName);
                file.Extension   = Path.GetExtension(file.DisplayName);
                file.CreateTime  = DateTime.Now;
                file.DbName      = GetFileDBName(file.Extension);
                file.FilePath    = "/" + fileFolder + "/" + file.DbName;
                file.ImgPath     = file.FilePath;

                ThumbnailHelper.Cut(inputFileName, filePath + file.DbName, toWidth, toHeight, cropWidth, cropHeight, x, y, fileType);
                return(file);
            }
            catch (Exception ex)
            {
                WebLogAgent.Write(ex);
                return(null);
            }
        }