예제 #1
0
            public void Should_return_a_new_image_object()
            {
                //Arrange
                //Act
                var result1 = _image.AddParameter("test1", "test1");
                var result2 = _image.AddParameter("test2", "test2");

                //Assert
                Assert.AreNotEqual(result1.Url, result2.Url);
                Assert.False(result1.Url.Contains("test2"));
                Assert.False(result2.Url.Contains("test1"));
            }
예제 #2
0
 /// <summary>
 /// Adds the blur parameter
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 0-1000
 ///     Default: 0
 /// </param>
 /// <returns></returns>
 public static ImgixImage Blur(this ImgixImage image, int value)
 => image.AddParameter("blur", value);
예제 #3
0
 /// <summary>
 /// Sets the width of the transformed image.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="width">The width value as a string</param>
 /// <returns></returns>
 public static ImgixImage Width(this ImgixImage image, string width) => image.AddParameter("w", width);
예제 #4
0
 /// <summary>
 /// Selects a sub-reqion of the image to use for processing
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="dimensions">
 ///     A comma seperated string of integers of the format "x,y,width,height"
 /// </param>
 /// <returns></returns>
 public static ImgixImage Rect(this ImgixImage image, string dimensions)
 => image.AddParameter("rect", dimensions);
예제 #5
0
 /// <summary>
 /// SEts the oputput quality of the image
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 0-100
 ///     Default: 75
 /// </param>
 /// <returns></returns>
 public static ImgixImage Quality(this ImgixImage image, int value)
 => image.AddParameter("q", value);
예제 #6
0
 /// <summary>
 /// Sets the output format of the image.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     The format name
 ///     Values: gif, jp2, jpg, json, jxr, pjpg, mp4, png, png8, png32, webp
 /// </param>
 /// <returns></returns>
 public static ImgixImage OutputFormat(this ImgixImage image, string value)
 => image.AddParameter("fm", value);
예제 #7
0
 /// <summary>
 /// When used in an a tag forces download with the specified name
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     The download name of the image
 /// </param>
 /// <returns></returns>
 public static ImgixImage Download(this ImgixImage image, string value)
 => image.AddParameter("dl", value);
예제 #8
0
 /// <summary>
 /// Chroma subsampling for JPEG and Progressive JPEG
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 420, 422, and 444
 ///     Default: 420
 /// </param>
 /// <returns></returns>
 public static ImgixImage ChromaSubsampling(this ImgixImage image, int value)
 => image.AddParameter("chromasub", value);
예제 #9
0
 /// <summary>
 /// Will add an auto enhancement parameter to the url
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     The value of the auto parameter
 ///     Values: enhance, format, redeye
 /// </param>
 /// <returns></returns>
 public static ImgixImage Auto(this ImgixImage image, string value)
 => image.AddParameter("auto", value);
예제 #10
0
 /// <summary>
 /// Adds a mask parameter with the supplied string as value
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">The value of the mask parameter</param>
 /// <returns></returns>
 public static ImgixImage Mask(this ImgixImage image, string value) => image.AddParameter("mask", value);
예제 #11
0
 /// <summary>
 /// Adds a mask parameter with the value ellipse
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <returns></returns>
 public static ImgixImage EllipseMask(this ImgixImage image) => image.AddParameter("mask", "ellipse");
예제 #12
0
 /// <summary>
 /// Adds a sepia toning effect to the image
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 0-100
 ///     Default: 0 (No change)
 /// </param>
 /// <returns></returns>
 public static ImgixImage SepiaTone(this ImgixImage image, int value)
 => image.AddParameter("sepia", value);
예제 #13
0
 /// <summary>
 /// Adds a pixellation effect
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 0-100
 ///     Default: 0 (No change)
 /// </param>
 /// <returns></returns>
 public static ImgixImage Pixellate(this ImgixImage image, int value)
 => image.AddParameter("px", value);
예제 #14
0
 /// <summary>
 /// Does a monochromatic hue change.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     3, 6 or 8 digit hex value
 /// </param>
 /// <returns></returns>
 public static ImgixImage Monochrome(this ImgixImage image, string value)
 => image.AddParameter("mono", value);
예제 #15
0
 /// <summary>
 /// Adds a half-toning effect to the image
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 0-100
 ///     Default: 0
 /// </param>
 /// <returns></returns>
 public static ImgixImage HalfTone(this ImgixImage image, int value)
 => image.AddParameter("htn", value);
예제 #16
0
 /// <summary>
 /// Sets the border around the image.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     A String describing the border.
 ///     Value: size,color
 ///     Size: An integer value
 ///     Color: An RGB or ARGB value
 /// </param>
 /// <returns></returns>
 public static ImgixImage Border(this ImgixImage image, string value)
 => image.AddParameter("border", value);
예제 #17
0
 /// <summary>
 /// Adds ch parameter opting in to using client hints.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     A comma seperated list of hints
 ///     Values: Width and DPR are currently supported
 /// </param>
 /// <returns></returns>
 public static ImgixImage ClientHints(this ImgixImage image, string value)
 => image.AddParameter("ch", value);
예제 #18
0
 /// <summary>
 /// Will add an auto enhancement parameter to the url
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="values">
 ///     One or more AutoOperations
 /// </param>
 /// <returns></returns>
 public static ImgixImage Auto(this ImgixImage image, params AutoOperation[] values)
 => image.AddParameter("auto", string.Join(",", values.Select(at => at.ToString().ToLower()).ToArray()));
예제 #19
0
 /// <summary>
 /// Adds color quantization to the image, limiting the amount of colors in the image.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 2-256
 /// </param>
 /// <returns></returns>
 public static ImgixImage ColorQuantization(this ImgixImage image, int value)
 => image.AddParameter("colorquant", value);
예제 #20
0
 /// <summary>
 /// Adds the timecolor parameter to the image url
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     A three or six char hex color string
 /// </param>
 /// <returns></returns>
 public static ImgixImage TrimColor(this ImgixImage image, string value)
 => image.AddParameter("trimcolor", value);
예제 #21
0
 /// <summary>
 /// Sets the DPI value in the Exif header
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     The DPI value
 /// </param>
 /// <returns></returns>
 public static ImgixImage DPI(this ImgixImage image, int value)
 => image.AddParameter("dpi", value);
예제 #22
0
 /// <summary>
 /// The difference threshhold used when trimming a border.
 /// Only valid when trim is set to auto
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     A lower value makes the trimming more aggressive
 ///     Default: 11
 /// </param>
 /// <returns></returns>
 public static ImgixImage TrimMeanDifference(this ImgixImage image, int value)
 => image.AddParameter("trimmd", value);
예제 #23
0
 /// <summary>
 /// Should the returned image be lossless
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     Values: 0, 1, true, false
 /// </param>
 /// <returns></returns>
 public static ImgixImage Lossless(this ImgixImage image, string value)
 => image.AddParameter("lossless", value);
예제 #24
0
 /// <summary>
 /// Defines the standard deviation among pixels in a border.
 /// Only valid when trim is set to auto
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     The standard deviation
 ///     Default: 10
 /// </param>
 /// <returns></returns>
 public static ImgixImage TrimStandardDeviation(this ImgixImage image, int value)
 => image.AddParameter("trimsd", value);
예제 #25
0
 /// <summary>
 /// How is the output image fit into the target dimensions.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="fit">
 ///     The fit mode
 ///     Values: clamp, clip, crop, facearea, fill, max, min, scale
 /// </param>
 /// <returns></returns>
 public static ImgixImage Fit(this ImgixImage image, string fit) => image.AddParameter("fit", fit);
예제 #26
0
 /// <summary>
 /// DEfines the tolerance when trim has been set to color.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     The tolerance
 ///     Default: 0
 /// </param>
 /// <returns></returns>
 public static ImgixImage TrimTolerance(this ImgixImage image, int value)
 => image.AddParameter("trimtol", value);
예제 #27
0
 /// <summary>
 /// Sets the height of the transformed image.
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="height">The height value as a string</param>
 /// <returns></returns>
 public static ImgixImage Height(this ImgixImage image, string height) => image.AddParameter("h", height);
예제 #28
0
 /// <summary>
 /// Adds a background color to the image if there is transparency in it
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     3, 4, 6 and 8 character color values
 /// </param>
 /// <returns></returns>
 public static ImgixImage BackgroundColor(this ImgixImage image, string value)
 => image.AddParameter("bg", value);
예제 #29
0
 /// <summary>
 /// Controls how the image is aligned when fit has been set to crop
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="cropMode">
 ///     The crop mode value. Can be a comma seperated list.
 ///     Values: top, bottom, left, right, faces, entropy
 /// </param>
 /// <returns></returns>
 public static ImgixImage Crop(this ImgixImage image, string cropMode) => image.AddParameter("crop", cropMode);
예제 #30
0
 /// <summary>
 /// Adds padding to the image.
 /// If the image does not have any size parameters the padding will extend the picture.
 /// If there are size parameters, the image will be shrunk to fit
 /// </summary>
 /// <param name="image">The image to transform</param>
 /// <param name="value">
 ///     The thickness of the padding.
 /// </param>
 /// <returns></returns>
 public static ImgixImage Padding(this ImgixImage image, int value)
 => image.AddParameter("pad", value);