Exemple #1
0
        public virtual void ProcessRequest(HttpContext context)
        {
            this.context = context;
            _imageService = new ImageService(new FileService(context), context);

            setContentType();
            setClientCaching();

            switch (imageMod)
            {
                case ImageMod.Raw:
                    context.Response.BinaryWrite(string.IsNullOrEmpty(QueryString["MaxSize"])
                                                    ? _imageService.Get(fileName, maxWidth, maxHeight, outputFormat)
                                                    : _imageService.Get(fileName, maxSize, outputFormat));
                    break;
                case ImageMod.SpecifiedCrop:
                    context.Response.BinaryWrite(_imageService.GetAndCrop(fileName, width, height, widthRatio, heightRatio, leftRatio, topRatio, outputFormat));
                    break;
                default:
                    context.Response.BinaryWrite(cacheEnabled
                                                 	? _imageService.GetCached(fileName, width, height, imageMod, hexBackGroundColour, anchor, outputFormat)
                                                 	: _imageService.Get(fileName, width, height, imageMod, hexBackGroundColour, anchor, outputFormat));
                    break;
            }
        }