当前位置: 首页>>代码示例>>C#>>正文


C# ImageUploadParams.ToParamsDictionary方法代码示例

本文整理汇总了C#中CloudinaryDotNet.Actions.ImageUploadParams.ToParamsDictionary方法的典型用法代码示例。如果您正苦于以下问题:C# ImageUploadParams.ToParamsDictionary方法的具体用法?C# ImageUploadParams.ToParamsDictionary怎么用?C# ImageUploadParams.ToParamsDictionary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CloudinaryDotNet.Actions.ImageUploadParams的用法示例。


在下文中一共展示了ImageUploadParams.ToParamsDictionary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestEagerTransformationList

        public void TestEagerTransformationList()
        {
            List<Transformation> list = new List<Transformation>(){
                new EagerTransformation().SetFormat("jpg").Crop("scale").Width(2.0),
                new EagerTransformation(new Transformation().Width(10),new Transformation().Angle(10)),
                new Transformation().Width(20).Height(20)
            };

            ImageUploadParams uploadParams = new ImageUploadParams()
            {
                EagerTransforms = list
            };

            SortedDictionary<string, object> dict = uploadParams.ToParamsDictionary();

            Assert.AreEqual("c_scale,w_2.0/jpg|w_10/a_10|h_20,w_20", dict["eager"]);
        }
开发者ID:cloudinary,项目名称:CloudinaryDotNet,代码行数:17,代码来源:ApiTest.cs

示例2: Upload

        /// <summary>
        /// Uploads an image file to cloudinary.
        /// </summary>
        /// <param name="parameters">Parameters of image uploading .</param>
        /// <returns>Results of image uploading.</returns>
        public ImageUploadResult Upload(ImageUploadParams parameters)
        {
            string uri = m_api.ApiUrlImgUpV.BuildUrl();

            ResetInternalFileDescription(parameters.File);

            using (HttpWebResponse response = m_api.Call(HttpMethod.POST, uri, parameters.ToParamsDictionary(), parameters.File))
            {
                return ImageUploadResult.Parse(response);
            }
        }
开发者ID:saiber,项目名称:CloudinarySolution,代码行数:16,代码来源:Cloudinary.cs

示例3: TestAdHocParams

        public void TestAdHocParams()
        {
            var breakpoint = new ResponsiveBreakpoint().MaxImages(5).BytesStep(20)
                                .MinWidth(200).MaxWidth(1000).CreateDerived(false);

            ImageUploadParams uploadParams = new ImageUploadParams()
            {
                File = new FileDescription(m_testImagePath)
            };

            uploadParams.AddCustomParam("public_id", "test_ad_hoc_params_id");
            uploadParams.AddCustomParam("tags", "test");
            uploadParams.AddCustomParam("IgnoredEmptyParameter", "");
            uploadParams.AddCustomParam("responsive_breakpoints", JsonConvert.SerializeObject(new List<ResponsiveBreakpoint> { breakpoint }));
            uploadParams.AddCustomParam("IgnoredNullParameter", null);

            var paramsDict = uploadParams.ToParamsDictionary();
            Assert.AreEqual(3, paramsDict.Count);
            Assert.IsFalse(paramsDict.ContainsKey("IgnoredEmptyParameter"));
            Assert.IsFalse(paramsDict.ContainsKey("IgnoredNullParameter"));

            ImageUploadResult result = m_cloudinary.Upload(uploadParams);
            Assert.AreEqual(1, result.ResponsiveBreakpoints.Count);

            Assert.AreEqual(5, result.ResponsiveBreakpoints[0].Breakpoints.Count);
            Assert.AreEqual(1000, result.ResponsiveBreakpoints[0].Breakpoints[0].Width);
            Assert.AreEqual(200, result.ResponsiveBreakpoints[0].Breakpoints[4].Width);
        }
开发者ID:cloudinary,项目名称:CloudinaryDotNet,代码行数:28,代码来源:CloudinaryTest.cs


注:本文中的CloudinaryDotNet.Actions.ImageUploadParams.ToParamsDictionary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。