public void TestAccessibilityAnalysis()
        {
            var uploadRes = UploadTestImageResource(uploadParams =>
            {
                uploadParams.AccessibilityAnalysis = true;
            });

            var explicitParams = new ExplicitParams(uploadRes.PublicId)
            {
                AccessibilityAnalysis = true,
                Type = STORAGE_TYPE_UPLOAD,
                Tags = m_apiTag
            };

            var explicitResult = m_cloudinary.Explicit(explicitParams);

            CloudinaryAssert.AccessibilityAnalysisNotEmpty(explicitResult.AccessibilityAnalysis);
        }
        public void TestCinemagraphAnalysis()
        {
            var uploadRes = UploadTestImageResource(uploadParams =>
            {
                uploadParams.CinemagraphAnalysis = true;
            });

            var explicitParams = new ExplicitParams(uploadRes.PublicId)
            {
                CinemagraphAnalysis = true,
                Type = STORAGE_TYPE_UPLOAD,
                Tags = m_apiTag
            };

            var explicitResult = m_cloudinary.Explicit(explicitParams);

            Assert.GreaterOrEqual(explicitResult.CinemagraphAnalysis.CinemagraphScore, 0);
        }
        public void TestJsonObject()
        {
            var exp = new ExplicitParams("cloudinary")
            {
                EagerTransforms = new List <Transformation>()
                {
                    m_simpleTransformation
                },
                Type = StorageType.facebook.ToString(),
                Tags = m_apiTag
            };

            var result = m_cloudinary.Explicit(exp);

            AddCreatedPublicId(StorageType.facebook, result.PublicId);

            Assert.NotNull(result.JsonObj);
            Assert.AreEqual(result.PublicId, result.JsonObj["public_id"].ToString());
        }
        public void TestExplicit()
        {
            ExplicitParams exp = new ExplicitParams("cloudinary")
            {
                EagerTransforms = new List <Transformation>()
                {
                    new Transformation().Crop("scale").Width(2.0)
                },
                Type = "twitter_name"
            };

            ExplicitResult expResult = m_cloudinary.Explicit(exp);

            string url = new Url(m_account.Cloud).ResourceType("image").Add("twitter_name").
                         Transform(new Transformation().Crop("scale").Width(2.0)).
                         Format("png").Version(expResult.Version).BuildUrl("cloudinary");

            Assert.AreEqual(url, expResult.Eager[0].Uri.AbsoluteUri);
        }
        public void TestExplicitAsyncProcessing()
        {
            var publicId = GetUniquePublicId();
            var facebook = StorageType.facebook.ToString();

            var exp = new ExplicitParams(publicId)
            {
                EagerTransforms = new List <Transformation>()
                {
                    new Transformation().Crop("scale").Width(2.0)
                },
                Type  = facebook,
                Async = true,
            };

            var expAsyncResult = m_cloudinary.Explicit(exp);

            Assert.AreEqual("pending", expAsyncResult.Status);
            Assert.AreEqual(Api.GetCloudinaryParam(ResourceType.Image), expAsyncResult.ResourceType);
            Assert.AreEqual(facebook, expAsyncResult.Type);
            Assert.AreEqual(publicId, expAsyncResult.PublicId);
        }
        public void TestExplicit()
        {
            var facebook   = StorageType.facebook.ToString();
            var cloudinary = "cloudinary";
            var exp        = new ExplicitParams(cloudinary)
            {
                EagerTransforms = new List <Transformation>()
                {
                    m_explicitTransformation
                },
                Type = facebook,
                Tags = m_apiTag
            };

            var expResult = m_cloudinary.Explicit(exp);

            var url = new Url(m_account.Cloud).ResourceType(Api.GetCloudinaryParam(ResourceType.Image)).Add(facebook).
                      Transform(m_explicitTransformation).
                      Format(FILE_FORMAT_PNG).Version(expResult.Version).BuildUrl(cloudinary);

            Assert.AreEqual(url, expResult.Eager[0].Uri.AbsoluteUri);
        }
        public void TestEager()
        {
            var publicId = GetUniquePublicId();

            // An array of breakpoints
            var uploadParams = new ImageUploadParams()
            {
                File     = new FileDescription(m_testImagePath),
                PublicId = publicId,
                Tags     = m_apiTag
            };

            m_cloudinary.Upload(uploadParams);

            // responsive breakpoints for Explicit()
            var exp = new ExplicitParams(publicId)
            {
                EagerTransforms = new List <Transformation>()
                {
                    m_simpleTransformation
                },
                Type = STORAGE_TYPE_UPLOAD,
                Tags = m_apiTag
            };

            ExplicitResult expResult = m_cloudinary.Explicit(exp);

            Assert.NotZero(expResult.Eager.Length);
            Assert.NotNull(expResult.Eager[0]);
            Assert.AreEqual(expResult.Eager[0].SecureUrl, expResult.Eager[0].SecureUrl);
            Assert.AreEqual(expResult.Eager[0].Url, expResult.Eager[0].Url);
            Assert.NotZero(expResult.Eager[0].Width);
            Assert.NotZero(expResult.Eager[0].Height);
            Assert.NotNull(expResult.Eager[0].Format);
            Assert.NotZero(expResult.Eager[0].Bytes);
            Assert.NotNull(expResult.Eager[0].Transformation);
        }
 /// <summary>
 /// This method can be used to force refresh facebook and twitter profile pictures. The response of this method includes the image's version. Use this version to bypass previously cached CDN copies.
 /// Also it can be used to generate transformed versions of an uploaded image. This is useful when Strict Transformations are allowed for your account and you wish to create custom derived images for already uploaded images.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 public Task <ExplicitResult> ExplicitAsync(ExplicitParams parameters)
 {
     return(CallAsync(Explicit, parameters));
 }
 public static ExplicitResult Explicit(this Cloudinary cloudinary, ExplicitParams parameters)
 {
     return(cloudinary.ExplicitAsync(parameters).ExecSync());
 }