public void ProcessRequest(HttpContext context) { this.context = context; var service = new ImageService(context); setContentType(); setClientCaching(); switch (imageMod) { case ImageMod.Raw: context.Response.BinaryWrite(string.IsNullOrEmpty(QueryString["MaxSize"]) ? service.Get(fileName, maxWidth, maxHeight, outputFormat) : service.Get(fileName, maxSize, outputFormat)); break; case ImageMod.SpecifiedCrop: context.Response.BinaryWrite(service.GetAndCrop(fileName, width, height, widthRatio, heightRatio, leftRatio, topRatio, outputFormat)); break; default: context.Response.BinaryWrite(cacheEnabled ? service.GetCached(fileName, width, height, imageMod, hexBackGroundColour, anchor, outputFormat) : service.Get(fileName, width, height, imageMod, hexBackGroundColour, anchor, outputFormat)); break; } }