Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            HttpResponse Response = context.Response;
            HttpRequest Request = context.Request;
            HttpServerUtility Server = context.Server;


            Response.ContentType = "text/plain";

            string action = Request["action"];
            string sourceFilePath = Request["srcFile"];
            string param=Request["param"];

            if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(sourceFilePath) || string.IsNullOrEmpty(param))
            {
                Response.Write("参数不足");
                return;
            }

            string physicalSourcePath = Server.MapPath(sourceFilePath);
            string fileName = Path.GetFileNameWithoutExtension(physicalSourcePath) ;
            string destinationFilePath=  string.Empty;
            QJVRMS.Common.ImageController obj = new QJVRMS.Common.ImageController();
            
            //switch (action)
            //{ 
            //    case "gray":
            //        fileName = fileName + "_" + action + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.ToGray(physicalSourcePath, destinationFilePath);
            //        break;
            //    case "rotate":
            //        fileName = fileName + "_" + action + "_"+param+".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.Rotate(physicalSourcePath, destinationFilePath, Convert.ToInt32(param));
            //        break;
            //    case "border":
            //        string[] _arr=param.Split(new char[]{','});
            //        fileName = fileName + "_" + action + "_" + _arr[0] + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.AddBorder(physicalSourcePath, destinationFilePath, _arr[1],Convert.ToInt32(_arr[0]));
            //        break;
            //    case "flip":
            //        fileName = fileName + "_" + action + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.Flip(physicalSourcePath, destinationFilePath);
            //        break;
            //    case "flop":
            //        fileName = fileName + "_" + action + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.Flop(physicalSourcePath, destinationFilePath);
            //        break;

            //}
            Response.Write("TempPath/" + fileName);
            //File.Delete(destinationFilePath);
        }
Example #2
0
        public static ArrayList ToZipImage(ArrayList sourceFileList, ArrayList aimFileList, int MaxLength)
        {
            if (sourceFileList.Count != aimFileList.Count)
            {
                throw new System.ArgumentException("压缩文件数量不匹配!");
            }


            ArrayList successZipList = new ArrayList(sourceFileList.Count);

            for (int i = 0; i < sourceFileList.Count; i++)
            {
                ImageController jpg    = null;
                byte[]          buffer = null;

                try
                {
                    jpg = new ImageController(sourceFileList[i].ToString());

                    //jpg.ZoomIn(MaxLength, ZPRI.HighSpeed);
                    //2010-3-22 ciqq 高质量压缩
                    jpg.ZoomIn(MaxLength, ZPRI.HighQuality);

                    buffer = jpg.FinalImage;

                    ZipFileManager.CreateFile(aimFileList[i].ToString(), buffer);

                    successZipList.Add(sourceFileList[i].ToString());
                }
                catch
                {
                }
                finally
                {
                    if (jpg != null)
                    {
                        jpg.Dispose();
                    }
                }
            }

            GC.Collect();

            return(successZipList);
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            HttpResponse      Response = context.Response;
            HttpRequest       Request  = context.Request;
            HttpServerUtility Server   = context.Server;


            Response.ContentType = "text/plain";

            string action         = Request["action"];
            string sourceFilePath = Request["srcFile"];
            string param          = Request["param"];

            if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(sourceFilePath) || string.IsNullOrEmpty(param))
            {
                Response.Write("参数不足");
                return;
            }

            string physicalSourcePath  = Server.MapPath(sourceFilePath);
            string fileName            = Path.GetFileNameWithoutExtension(physicalSourcePath);
            string destinationFilePath = string.Empty;

            QJVRMS.Common.ImageController obj = new QJVRMS.Common.ImageController();

            //switch (action)
            //{
            //    case "gray":
            //        fileName = fileName + "_" + action + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.ToGray(physicalSourcePath, destinationFilePath);
            //        break;
            //    case "rotate":
            //        fileName = fileName + "_" + action + "_"+param+".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.Rotate(physicalSourcePath, destinationFilePath, Convert.ToInt32(param));
            //        break;
            //    case "border":
            //        string[] _arr=param.Split(new char[]{','});
            //        fileName = fileName + "_" + action + "_" + _arr[0] + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.AddBorder(physicalSourcePath, destinationFilePath, _arr[1],Convert.ToInt32(_arr[0]));
            //        break;
            //    case "flip":
            //        fileName = fileName + "_" + action + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.Flip(physicalSourcePath, destinationFilePath);
            //        break;
            //    case "flop":
            //        fileName = fileName + "_" + action + ".jpg";
            //        destinationFilePath = Server.MapPath("TempPath/" + fileName);
            //        obj.Flop(physicalSourcePath, destinationFilePath);
            //        break;

            //}
            Response.Write("TempPath/" + fileName);
            //File.Delete(destinationFilePath);
        }