Exemple #1
0
        /// <summary>
        /// Sets the output format of the image. See https://github.com/thumbor/thumbor/wiki/Format for details.
        /// Can be called multiple times with the last call overriding all previous calls.
        /// </summary>
        /// <param name="imageFormat">Image format that should be specified.</param>
        /// <returns>The current thumbor image object.</returns>
        public ThumborImage Format(Thumbor.ImageFormat imageFormat)
        {
            if (imageFormat != Thumbor.ImageFormat.None)
            {
                this.ReplaceOrAddFilter("format", imageFormat.ToString().ToLower());
            }

            return(this);
        }
Exemple #2
0
        public void ThumborFormat(Thumbor.ImageFormat format)
        {
            var thumbor    = new Thumbor("http://localhost/");
            var resizedUrl = thumbor.BuildImage("http://localhost/image.jpg")
                             .Format(format)
                             .ToFullUrl();

            resizedUrl.Should().Be(string.Format("http://localhost/unsafe/filters:format({0})/http://localhost/image.jpg", format.ToString().ToLower()));
        }