public void TestImageThumbnail()
        {
            var originalImageStoreFileInfoFirst  = new FileStoreInfo("C:\\按周查看.bmp");
            var originalImageStoreFileInfoSecond = new FileStoreInfo()
            {
                FileNameWithoutExtension = "按周查看",
                FileDirectory            = "c:\\",
                ExtensionName            = ".bmp"
            };
            var thumbnailPropertyFisrt = new ThumbnailProperty()
            {
                Color  = Color.White,
                Width  = 200,
                Height = 200
            };
            var thumbnailPropertySecond = new ThumbnailProperty()
            {
                Color  = Color.Transparent,
                Width  = 940,
                Height = 360
            };
            var thumbnailPropertyThird = DefaultThumbnailNameProvider
                                         .GetThumbnailPropertyFromFileName("C:\\按周查看.bmp_thumb_800x400x0xoooooo.png");
            var ogrinalFileInfo =
                DefaultThumbnailNameProvider.GetOriginalFileNameFromFileName("C:\\按周查看.bmp_thumb_800x400x0xoooooo.png");

            ImageUtility.Thumbnail(originalImageStoreFileInfoFirst, thumbnailPropertyFisrt);
            ImageUtility.Thumbnail(originalImageStoreFileInfoSecond, thumbnailPropertySecond);
            ImageUtility.Thumbnail(originalImageStoreFileInfoSecond, thumbnailPropertyThird);
        }
        public void ProcessRequest(HttpContext context)
        {
            var paramsStr = context.Request["params"];
            //判断图片是否存在
            var physicalPath = context.Request.PhysicalPath;

            if (string.IsNullOrEmpty(paramsStr))
            {
                context.Response.WriteFile(context.Request.PhysicalPath);
                return;
            }
            var thumbProperty = DefaultThumbnailNameProvider.GetThumbnailPropertyFromParamExpression(paramsStr);

            if (thumbProperty == null)
            {
                context.Response.WriteFile(context.Request.PhysicalPath);
                return;
            }
            var defaultThumbnailNameProvider = new DefaultThumbnailNameProvider();
            var originalFileInfo             = new FileStoreInfo(physicalPath);
            var thumbImageFileInfo           = defaultThumbnailNameProvider.GetThumbnailFileInfo(originalFileInfo, thumbProperty);

            if (!File.Exists(thumbImageFileInfo.FullFileName))
            {
                ImageUtility.Thumbnail(originalFileInfo, thumbProperty, defaultThumbnailNameProvider);
            }
            context.Response.ClearHeaders();
            context.Response.ContentType = "image/jpeg";
            context.Response.Headers.Add("Content-Type", "image/jpeg");
            //context.Response.AddHeader("Content-Disposition", "attachment;filename=" + originalFileInfo.FileNameWithExtension);
            context.Response.WriteFile(thumbImageFileInfo.FullFileName);
        }