本文整理汇总了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"]);
}
示例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);
}
}
示例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);
}