Exemple #1
0
        /// <summary>
        /// Maps object model to dictionary of parameters in cloudinary notation
        /// </summary>
        /// <returns>Sorted dictionary of parameters</returns>
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            SortedDictionary <string, object> dict = new SortedDictionary <string, object>();

            AddParam(dict, "public_id", PublicId);
            AddParam(dict, "tags", Tags);
            AddParam(dict, "type", Type);

            if (EagerTransforms != null)
            {
                AddParam(dict, "eager",
                         String.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }

            if (Headers != null && Headers.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var item in Headers)
                {
                    sb.AppendFormat("{0}: {1}\n", item.Key, item.Value);
                }

                dict.Add("headers", sb.ToString());
            }

            return(dict);
        }
        /// <summary>
        /// Maps object model to dictionary of parameters in cloudinary notation
        /// </summary>
        /// <returns>Sorted dictionary of parameters</returns>
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            SortedDictionary <string, object> dict = base.ToParamsDictionary();

            AddParam(dict, "format", Format);
            AddParam(dict, "exif", Exif);
            AddParam(dict, "faces", Faces);
            AddParam(dict, "colors", Colors);
            AddParam(dict, "image_metadata", Metadata);
            AddParam(dict, "eager_async", EagerAsync);
            AddParam(dict, "eager_notification_url", EagerNotificationUrl);

            if (Transformation != null)
            {
                AddParam(dict, "transformation", Transformation.Generate());
            }

            if (EagerTransforms != null && EagerTransforms.Count > 0)
            {
                AddParam(dict, "eager",
                         String.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }

            return(dict);
        }
Exemple #3
0
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            var paramsDictionary = base.ToParamsDictionary();

            AddParam(paramsDictionary, "public_id", PublicId);
            AddParam(paramsDictionary, "tags", Tags);
            AddParam(paramsDictionary, "type", Type);
            AddParam(paramsDictionary, "eager_async", EagerAsync);
            AddParam(paramsDictionary, "eager_notification_url", EagerNotificationUrl);
            AddParam(paramsDictionary, "invalidate", Invalidate);
            AddCoordinates(paramsDictionary, "face_coordinates", FaceCoordinates);
            AddCoordinates(paramsDictionary, "custom_coordinates", CustomCoordinates);
            if (EagerTransforms != null)
            {
                AddParam(paramsDictionary, "eager", string.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }
            if (Context != null && Context.Count > 0)
            {
                AddParam(paramsDictionary, "context", Context.ReducePiped());
            }
            if (ResponsiveBreakpoints != null && ResponsiveBreakpoints.Count > 0)
            {
                AddParam(paramsDictionary, "responsive_breakpoints", JsonConvert.SerializeObject(ResponsiveBreakpoints));
            }
            if (Headers != null && Headers.Count > 0)
            {
                var stringBuilder = new StringBuilder();
                foreach (var header in Headers)
                {
                    stringBuilder.AppendFormat("{0}: {1}\n", header.Key, header.Value);
                }
                paramsDictionary.Add("headers", stringBuilder.ToString());
            }
            return(paramsDictionary);
        }
Exemple #4
0
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            var paramsDictionary = base.ToParamsDictionary();

            AddParam(paramsDictionary, "name", Name);
            AddParam(paramsDictionary, "unsigned", Unsigned);
            AddParam(paramsDictionary, "disallow_public_id", DisallowPublicId);
            AddParam(paramsDictionary, "type", Type);
            AddParam(paramsDictionary, "tags", Tags);
            AddParam(paramsDictionary, "use_filename", UseFilename);
            AddParam(paramsDictionary, "moderation", Moderation);
            AddParam(paramsDictionary, "format", Format);
            AddParam(paramsDictionary, "exif", Exif);
            AddParam(paramsDictionary, "faces", Faces);
            AddParam(paramsDictionary, "colors", Colors);
            AddParam(paramsDictionary, "image_metadata", Metadata);
            AddParam(paramsDictionary, "eager_async", EagerAsync);
            AddParam(paramsDictionary, "eager_notification_url", EagerNotificationUrl);
            AddParam(paramsDictionary, "categorization", Categorization);
            AddParam(paramsDictionary, "detection", Detection);
            AddParam(paramsDictionary, "ocr", Ocr);
            AddParam(paramsDictionary, "similarity_search", SimilaritySearch);
            AddParam(paramsDictionary, "invalidate", Invalidate);
            AddParam(paramsDictionary, "discard_original_filename", DiscardOriginalFilename);
            AddParam(paramsDictionary, "notification_url", NotificationUrl);
            AddParam(paramsDictionary, "proxy", Proxy);
            AddParam(paramsDictionary, "folder", Folder);
            AddParam(paramsDictionary, "raw_convert", RawConvert);
            AddParam(paramsDictionary, "backup", Backup);
            AddParam(paramsDictionary, "overwrite", Overwrite);
            AddParam(paramsDictionary, "unique_filename", UniqueFilename);
            AddParam(paramsDictionary, "transformation", GetTransformation(Transformation));
            if (AutoTagging.HasValue)
            {
                AddParam(paramsDictionary, "auto_tagging", AutoTagging.Value);
            }
            if (FaceCoordinates != null)
            {
                AddParam(paramsDictionary, "face_coordinates", FaceCoordinates.ToString());
            }
            if (EagerTransforms != null && EagerTransforms.Count > 0)
            {
                AddParam(paramsDictionary, "eager", string.Join("|", EagerTransforms.Select(GetTransformation).ToArray()));
            }
            if (AllowedFormats != null)
            {
                AddParam(paramsDictionary, "allowed_formats", string.Join(",", AllowedFormats));
            }
            if (Context != null && Context.Count > 0)
            {
                AddParam(paramsDictionary, "context", Context.ReducePiped());
            }
            return(paramsDictionary);
        }
Exemple #5
0
        /// <summary>
        /// Maps object model to dictionary of parameters in cloudinary notation.
        /// </summary>
        /// <returns>Sorted dictionary of parameters.</returns>
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            SortedDictionary <string, object> dict = base.ToParamsDictionary();

            AddParam(dict, "public_id", PublicId);
            AddParam(dict, "tags", Tags);
            AddParam(dict, "type", Type);
            AddParam(dict, "ocr", Ocr);
            AddParam(dict, "eager_async", EagerAsync);
            AddParam(dict, "eager_notification_url", EagerNotificationUrl);
            AddParam(dict, "invalidate", Invalidate);
            AddParam(dict, "async", Async);
            AddParam(dict, "quality_analysis", QualityAnalysis);

            AddCoordinates(dict, "face_coordinates", FaceCoordinates);
            AddCoordinates(dict, "custom_coordinates", CustomCoordinates);

            if (EagerTransforms != null)
            {
                AddParam(
                    dict,
                    "eager",
                    string.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }

            if (Context != null && Context.Count > 0)
            {
                AddParam(dict, Constants.CONTEXT_PARAM_NAME, Utils.SafeJoin("|", Context.SafePairs));
            }

            if (ResponsiveBreakpoints != null && ResponsiveBreakpoints.Count > 0)
            {
                AddParam(dict, "responsive_breakpoints", JsonConvert.SerializeObject(ResponsiveBreakpoints));
            }

            if (AccessControl != null && AccessControl.Count > 0)
            {
                AddParam(dict, "access_control", JsonConvert.SerializeObject(AccessControl));
            }

            if (Headers != null && Headers.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var item in Headers)
                {
                    sb.AppendFormat("{0}: {1}\n", item.Key, item.Value);
                }

                dict.Add("headers", sb.ToString());
            }

            return(dict);
        }
        /// <summary>
        /// Maps object model to dictionary of parameters in cloudinary notation.
        /// </summary>
        /// <returns>Sorted dictionary of parameters.</returns>
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            var dict = base.ToParamsDictionary();

            AddParam(dict, "format", Format);
            AddParam(dict, "exif", Exif);
            AddParam(dict, "faces", Faces);
            AddParam(dict, "quality_analysis", QualityAnalysis);
            AddParam(dict, "colors", Colors);
            AddParam(dict, "image_metadata", ImageMetadata);
            AddParam(dict, "eager_async", EagerAsync);
            AddParam(dict, "eager_notification_url", EagerNotificationUrl);
            AddParam(dict, "categorization", Categorization);
            AddParam(dict, "detection", Detection);
            AddParam(dict, "ocr", Ocr);
            AddParam(dict, "similarity_search", SimilaritySearch);
            AddParam(dict, "upload_preset", UploadPreset);
            AddParam(dict, "unsigned", Unsigned);
            AddParam(dict, "phash", Phash);
            AddParam(dict, "background_removal", BackgroundRemoval);
            AddParam(dict, "return_delete_token", ReturnDeleteToken);
            AddParam(dict, "cinemagraph_analysis", CinemagraphAnalysis);
            AddParam(dict, "accessibility_analysis", AccessibilityAnalysis);

            if (AutoTagging.HasValue)
            {
                AddParam(dict, "auto_tagging", AutoTagging.Value);
            }

            AddCoordinates(dict, "face_coordinates", FaceCoordinates);
            AddCoordinates(dict, "custom_coordinates", CustomCoordinates);

            if (Transformation != null)
            {
                AddParam(dict, "transformation", Transformation.Generate());
            }

            if (EagerTransforms != null && EagerTransforms.Count > 0)
            {
                AddParam(
                    dict,
                    "eager",
                    string.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }

            if (ResponsiveBreakpoints != null && ResponsiveBreakpoints.Count > 0)
            {
                AddParam(dict, "responsive_breakpoints", JsonConvert.SerializeObject(ResponsiveBreakpoints));
            }

            return(dict);
        }
Exemple #7
0
        /// <summary>
        /// Maps object model to dictionary of parameters in cloudinary notation
        /// </summary>
        /// <returns>Sorted dictionary of parameters</returns>
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            SortedDictionary <string, object> dict = base.ToParamsDictionary();

            AddParam(dict, "tags", Tags);
            AddParam(dict, "format", Format);

            AddParam(dict, "exif", Exif);
            AddParam(dict, "faces", Faces);
            AddParam(dict, "colors", Colors);
            AddParam(dict, "image_metadata", Metadata);
            AddParam(dict, "use_filename", UseFilename);
            AddParam(dict, "eager_async", EagerAsync);

            AddParam(dict, "notification_url", NotificationUrl);
            AddParam(dict, "eager_notification_url", EagerNotificationUrl);

            if (Transformation != null)
            {
                AddParam(dict, "transformation", Transformation.Generate());
            }

            if (EagerTransforms != null && EagerTransforms.Count > 0)
            {
                AddParam(dict, "eager",
                         String.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }

            if (Headers != null && Headers.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var item in Headers)
                {
                    sb.AppendFormat("{0}: {1}\n", item.Key, item.Value);
                }

                dict.Add("headers", sb.ToString());
            }

            return(dict);
        }
        /// <summary>
        /// Maps object model to dictionary of parameters in cloudinary notation
        /// </summary>
        /// <returns>Sorted dictionary of parameters</returns>
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            SortedDictionary <string, object> dict = new SortedDictionary <string, object>();

            AddParam(dict, "public_id", PublicId);
            AddParam(dict, "tags", Tags);
            AddParam(dict, "type", Type);
            AddParam(dict, "eager_async", EagerAsync);
            AddParam(dict, "eager_notification_url", EagerNotificationUrl);

            AddCoordinates(dict, "face_coordinates", FaceCoordinates);
            AddCoordinates(dict, "custom_coordinates", CustomCoordinates);

            if (EagerTransforms != null)
            {
                AddParam(dict, "eager",
                         String.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }

            if (Context != null && Context.Count > 0)
            {
                AddParam(dict, "context", String.Join("|", Context.Pairs));
            }

            if (Headers != null && Headers.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var item in Headers)
                {
                    sb.AppendFormat("{0}: {1}\n", item.Key, item.Value);
                }

                dict.Add("headers", sb.ToString());
            }

            return(dict);
        }
Exemple #9
0
        /// <summary>
        /// Maps object model to dictionary of parameters in cloudinary notation.
        /// </summary>
        /// <returns>Sorted dictionary of parameters.</returns>
        public override SortedDictionary <string, object> ToParamsDictionary()
        {
            var dict = base.ToParamsDictionary();

            AddParam(dict, "public_id", PublicId);
            AddParam(dict, "tags", Tags);
            AddParam(dict, "type", Type);
            AddParam(dict, "ocr", Ocr);
            AddParam(dict, "eager_async", EagerAsync);
            AddParam(dict, "eager_notification_url", EagerNotificationUrl);
            AddParam(dict, "invalidate", Invalidate);
            AddParam(dict, "async", Async);
            AddParam(dict, "quality_analysis", QualityAnalysis);
            AddParam(dict, "cinemagraph_analysis", CinemagraphAnalysis);
            AddParam(dict, "overwrite", Overwrite);
            AddParam(dict, "image_metadata", ImageMetadata);
            AddParam(dict, "notification_url", NotificationUrl);
            AddParam(dict, "quality_override", QualityOverride);
            AddParam(dict, "moderation", Moderation);
            AddParam(dict, "accessibility_analysis", AccessibilityAnalysis);

            if (ResourceType == ResourceType.Image)
            {
                AddParam(dict, "colors", Colors);
                AddParam(dict, "phash", Phash);
                AddParam(dict, "faces", Faces);
            }

            AddCoordinates(dict, "face_coordinates", FaceCoordinates);
            AddCoordinates(dict, "custom_coordinates", CustomCoordinates);

            if (EagerTransforms != null)
            {
                AddParam(
                    dict,
                    "eager",
                    string.Join("|", EagerTransforms.Select(t => t.Generate()).ToArray()));
            }

            if (Context != null && Context.Count > 0)
            {
                AddParam(dict, Constants.CONTEXT_PARAM_NAME, Utils.SafeJoin("|", Context.SafePairs));
            }

            if (Metadata != null && Metadata.Count > 0)
            {
                AddParam(dict, Constants.METADATA_PARAM_NAME, Utils.SafeJoin("|", Metadata.SafePairs));
            }

            if (ResponsiveBreakpoints != null && ResponsiveBreakpoints.Count > 0)
            {
                AddParam(dict, "responsive_breakpoints", JsonConvert.SerializeObject(ResponsiveBreakpoints));
            }

            if (AccessControl != null && AccessControl.Count > 0)
            {
                AddParam(dict, "access_control", JsonConvert.SerializeObject(AccessControl));
            }

            if (Headers != null && Headers.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var item in Headers)
                {
                    sb.AppendFormat(CultureInfo.InvariantCulture, "{0}: {1}\n", item.Key, item.Value);
                }

                dict.Add("headers", sb.ToString());
            }

            return(dict);
        }