Inheritance: IMediaTransformer
        public bool TryCreateTransformer(HttpRequestBase request, IFormatInfo originalFormat, IFormatInfoProvider formatInfoProvider, out IMediaTransformer mediaTransformer)
        {
            var transforms = GetBitmapTransforms(request.QueryString).ToArray();
            if (!transforms.Any())
            {
                mediaTransformer = null;
                return false;
            }

            IFormatInfo outputFormat;
            BitmapEncoder encoder;

            if (!TryGetContentType(originalFormat, request, formatInfoProvider, out outputFormat, out encoder))
            {
                mediaTransformer = null;
                return false;
            }

            mediaTransformer = new ImageMediaTransformer(transforms, encoder, outputFormat);
            return true;
        }
示例#2
0
        public bool TryCreateTransformer(HttpRequestBase request, IFormatInfo originalFormat, IFormatInfoProvider formatInfoProvider, out IMediaTransformer mediaTransformer)
        {
            var transforms = GetBitmapTransforms(request.QueryString).ToArray();

            if (!transforms.Any())
            {
                mediaTransformer = null;
                return(false);
            }

            IFormatInfo   outputFormat;
            BitmapEncoder encoder;

            if (!TryGetContentType(originalFormat, request, formatInfoProvider, out outputFormat, out encoder))
            {
                mediaTransformer = null;
                return(false);
            }

            mediaTransformer = new ImageMediaTransformer(transforms, encoder, outputFormat);
            return(true);
        }