/// <summary> /// The fit transformation controls how the output image is fit to its target dimensions after resizing. /// </summary> /// <param name="fitMode">Specifies the mode for the transformation. </param> /// <returns>The same <see cref="ImageUrlBuilder" /> instance. </returns> public ImageUrlBuilder WithFitMode(string fitMode) { if (!string.IsNullOrWhiteSpace(fitMode) && ImageFitMode.TryParse(fitMode.ToLower(), out var parsedFitMode)) { WithFitMode(parsedFitMode); } return(this); }
/// <summary> /// The fit transformation controls how the output image is fit to its target dimensions after resizing. /// </summary> /// <param name="fitMode">Specifies the mode for the transformation. </param> /// <returns>The same <see cref="ImageUrlBuilder" /> instance. </returns> public ImageUrlBuilder WithFitMode(ImageFitMode fitMode) { _queryParameters["fit"] = fitMode.ToString(); return(this); }
/// <summary> /// Gets the value associated with this value. /// </summary> /// <param name="value">Value to parse.</param> /// <param name="fitMode"><see cref="ImageFitMode"/> representation of the <paramref name="value"/>.</param> /// <returns>Whether the value was parsed successfully.</returns> public static bool TryParse(string value, out ImageFitMode fitMode) => TranslateDictionary.TryGetValue(value, out fitMode);
/// <summary> /// The fit transformation controls how the output image is fit to its target dimensions after resizing. /// </summary> /// <param name="fitMode">Specifies the mode for the transformation. </param> /// <returns>The same <see cref="ImageUrlBuilder" /> instance. </returns> public ImageUrlBuilder WithFitMode(ImageFitMode fitMode) { _queryParameters["fit"] = StringifyEnum(fitMode); return(this); }