Example #1
0
        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/jpg|w_10/a_10/|h_20,w_20", dict["eager"]);
        }
Example #2
0
        /// <summary>
        /// Upload an image file to cloudinary
        /// </summary>
        /// <param name="parameters">Parameters for uploading image to cloudinary</param>
        /// <returns>Results of image uploading</returns>
        public ImageUploadResult Upload(ImageUploadParams parameters)
        {
            string uri = m_api.ApiUrlImgUpV.BuildUrl();

            using (HttpWebResponse response = m_api.Call(HttpMethod.POST, uri, parameters.ToParamsDictionary(), parameters.File))
            {
                return ImageUploadResult.Parse(response);
            }
        }