コード例 #1
0
        //инициализация
        public FileQueriesBase(IFileStorage fileStorage , ImageSettings settings)
        {
            FileStorage = fileStorage;
            Settings = settings;

            UploadImagePipeline = new UploadImagePipeline(fileStorage);
        }
コード例 #2
0
        private void CreatePostPreviewImage(string url, FileInfo imageFile)
        {
            var pipeline = new UploadImagePipeline(_fileStorage);
            
            PipelineResult result = pipeline.Process(new ImagePipelineModel()
            {
                InputStream = imageFile.OpenRead(),
                ContentLength = 0,              
                SizeLimit = int.MaxValue,
                Targets = new List<ImageTargetParameters>()
                {
                    new ImageTargetParameters()
                    {
                        TargetFormat = ImageFormat.Jpeg,
                        RoundCorners = true,
                        Width = 750,
                        Height = 420,
                        ResizeType = ImageResizeType.FitAndFill
                    }                  
                },
                TargetNamePaths = new List<string>()
                {
                    _previewQueries.PathCreator.CreateStaticNamePath(url)
                }
            }).Result;

            if(!result.Result)
            {
                throw new Exception(result.Message);
            }
        }