예제 #1
0
 public override void Handler(ImageRequest request, List <string> handlerResult)
 {
     if (request.Heith > 960)
     {
         var filePath = request.GenderTempFilePath();
         if (handlerResult.Count > 0)
         {
             using (Stream stream = new System.IO.FileStream(handlerResult.FirstOrDefault(), FileMode.Open))
             {
                 ImageClass.MyImage.CutForCustom(stream, filePath, 620, 960, 100);
             }
         }
         else
         {
             ImageClass.MyImage.CutForCustom(request.fileStream, filePath, 620, 960, 100);
         }
         if (File.Exists(handlerResult.FirstOrDefault()))
         {
             File.Delete(handlerResult.FirstOrDefault());
         }
         handlerResult.Clear();
         handlerResult.Add(filePath);
     }
     if (nextImageHandler != null)
     {
         nextImageHandler.Handler(request, handlerResult);
     }
 }
예제 #2
0
        public override void Handler(ImageRequest request, List <string> handlerResult)
        {
            var handler  = handlerResult.FirstOrDefault();
            var filePath = request.GenderTempFilePath();
            var isExcute = false;

            if (handler != null && File.Exists(handler))
            {
                using (var fileInfo = new FileStream(handler, FileMode.Open))
                {
                    if (fileInfo.Length > 819200)
                    {
                        isExcute = true;
                        ImageClass.MyImage.CutForCustom(fileInfo, filePath, request.Width, request.Heith, 80);
                    }
                    else
                    {
                        isExcute = true;
                        ImageClass.MyImage.CutForCustom(fileInfo, filePath, request.Width, request.Heith, 100);
                    }
                    //while (fileInfo.Length > 819200)
                    //{
                    //    isExcute = true;
                    //    using (var fileStream = new FileStream(handler, FileMode.Open))
                    //    {
                    //        ImageClass.MyImage.CutForCustom(fileStream, filePath, 620, 960, Convert.ToInt32(--curr));
                    //    }
                    //    fileInfo = new FileInfo(handler);
                    //}
                }
            }
            else
            {
                if (request.fileStream.Length > 819200)
                {
                    isExcute = true;
                    ImageClass.MyImage.CutForCustom(request.fileStream, filePath, request.Width, request.Heith, 80);
                }
                else
                {
                    isExcute = true;
                    ImageClass.MyImage.CutForCustom(request.fileStream, filePath, request.Width, request.Heith, 100);
                }
            }
            if (isExcute)
            {
                if (File.Exists(handlerResult.FirstOrDefault()))
                {
                    File.Delete(handlerResult.FirstOrDefault());
                }
                handlerResult.Clear();
                handlerResult.Add(filePath);
            }
            if (nextImageHandler != null)
            {
                nextImageHandler.Handler(request, handlerResult);
            }
        }
예제 #3
0
        public override void Handler(ImageRequest request, List <string> handlerResult)
        {
            var filePath = request.GenderTempFilePath();

            Magic.Common.CSVHelper.ImageClass.MyImage.CutForCustom(request.fileStream, filePath, 620, request.Heith, 100);
            handlerResult.Add(filePath);
            if (this.nextImageHandler != null)
            {
                this.nextImageHandler.Handler(request, handlerResult);
            }
        }