//=========================================================================================
        // Upload Image

        #region -- ProcessUploadImage --
        /// <summary>
        /// Processes the upload image.
        /// </summary>
        /// <param name="uploadFile">The upload file.</param>
        /// <returns></returns>
        public Dictionary <string, string> ProcessUploadImage(HttpPostedFileBase uploadFile)
        {
            var jo = new Dictionary <string, string>();

            if (uploadFile.ContentLength <= 0)
            {
                jo.Add("result", "error");
                jo.Add("msg", "無內容檔案!請重新選擇檔案!");
                return(jo);
            }
            else if (uploadFile.ContentLength >= 10240000)
            {
                //容量超過 10M (10240KB)
                jo.Add("result", "error");
                jo.Add("msg", "上傳檔案不可超過10M!請重新選擇檔案!");
                return(jo);
            }
            else
            {
                if (!IsImage(uploadFile))
                {
                    jo.Add("result", "error");
                    jo.Add("msg", "上傳檔案並不是圖片檔!請重新選擇檔案!");
                    return(jo);
                }

                // Picture Image_Type
                var imageTypes = new string[] { "jpg", "jpeg", "png", "gif" };
                var extension  = Path.GetExtension(uploadFile.FileName);
                if (extension != null && !imageTypes.Contains(extension.Substring(1, 3).ToLower()))
                {
                    jo.Add("result", "error");
                    jo.Add("msg", "上傳檔案的圖片檔只能接受 jpg, jpeg, png, gif!請重新選擇檔案!");
                    return(jo);
                }

                try
                {
                    //存檔
                    var fileName = String.Concat(
                        MiscUtility.MakeGuid().Replace("-", string.Empty).Substring(0, 20),
                        Path.GetExtension(uploadFile.FileName).ToLower());

                    uploadFile.SaveAs(string.Format(@"{0}\{1}", this.UploadPath, fileName));

                    jo.Add("result", "Success");
                    jo.Add("msg", fileName);
                }
                catch (Exception ex)
                {
                    jo.Add("result", "Failure");
                    jo.Add("msg", ex.Message);
                }
                return(jo);
            }
        }
        //=========================================================================================
        // Crop Image

        #region -- ProcessImageCrop --
        /// <summary>
        /// Processes the image crop.
        /// </summary>
        public Dictionary <string, string> ProcessImageCrop(
            UploadImage currentImage,
            int[] sectionValue)
        {
            var result = new Dictionary <string, string>();

            try
            {
                //取得裁剪的區域座標
                var sectionX1 = sectionValue[0];
                var sectionX2 = sectionValue[1];
                var sectionY1 = sectionValue[2];
                var sectionY2 = sectionValue[3];

                //取得裁剪的圖片寬高
                int width  = sectionX2 - sectionX1;
                int height = sectionY2 - sectionY1;

                //讀取原圖片
                System.Drawing.Image sourceImage = System.Drawing.Image.FromFile
                                                   (
                    string.Format(@"{0}\{1}", this.OriginalPath, currentImage.OriginalImage)
                                                   );

                //從原檔案取得裁剪圖片
                System.Drawing.Image cropImage = this.CropImage(
                    sourceImage,
                    new Rectangle(sectionX1, sectionY1, width, height)
                    );

                //將採剪下來的圖片做縮圖處理
                Bitmap resizeImage = this.ResizeImage(cropImage, new Size(100, 100));

                //將縮圖處理完成的圖檔儲存為JPG格式
                var fileName = String.Concat(MiscUtility.MakeGuid().Replace("-", string.Empty).Substring(0, 20), ".jpg");
                var savePath = string.Format(@"{0}\{1}", this.CropPath, fileName);
                SaveJpeg(savePath, resizeImage, 100L);

                //釋放檔案資源
                resizeImage.Dispose();
                cropImage.Dispose();
                sourceImage.Dispose();

                //如果有之前的裁剪圖片,暫存既有的裁剪圖片檔名
                string oldCropImageFileName = string.Empty;
                if (!string.IsNullOrWhiteSpace(currentImage.CropImage))
                {
                    oldCropImageFileName = currentImage.CropImage;
                }

                //JSON
                result.Add("result", "Success");
                result.Add("OriginalImage", currentImage.OriginalImage);
                result.Add("CropImage", fileName);
                result.Add("OldCropImage", oldCropImageFileName);
            }
            catch (Exception ex)
            {
                result.Add("result", "Exception");
                result.Add("msg", ex.Message);
            }
            return(result);
        }