GetAndCrop() public method

This returns a specified crop
public GetAndCrop ( string relativeFilePath, int targetWidth, int targetHeight, double widthRatio, double heightRatio, double leftRatio, double topRatio ) : Bitmap
relativeFilePath string e.g. asdf/asdf.jpg
targetWidth int
targetHeight int
widthRatio double
heightRatio double
leftRatio double
topRatio double
return System.Drawing.Bitmap
Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }