diff --git a/DotNetThumbor/DotNetThumbor.csproj b/DotNetThumbor/DotNetThumbor.csproj index 6561328..0912adb 100644 --- a/DotNetThumbor/DotNetThumbor.csproj +++ b/DotNetThumbor/DotNetThumbor.csproj @@ -2,12 +2,19 @@ netstandard2.0 + DotNetThumbor.dll + 1.2 + Mi9 + https://github.com/mi9/DotNetThumbor/blob/master/LICENSE + https://github.com/mi9/DotNetThumbor + true + DotNet library for the Thumbor image service which allows you to build URIs using a fluent API. + thumbor image resizer false - - + - \ No newline at end of file + diff --git a/DotNetThumbor/DotNetThumbor.dll.nuspec b/DotNetThumbor/DotNetThumbor.dll.nuspec deleted file mode 100644 index b164757..0000000 --- a/DotNetThumbor/DotNetThumbor.dll.nuspec +++ /dev/null @@ -1,14 +0,0 @@ - - - - DotNetThumbor.dll - 1.0 - Mi9 - Mi9 - https://github.com/mi9/DotNetThumbor/blob/master/LICENSE - https://github.com/mi9/DotNetThumbor - true - DotNet library for the Thumbor image service which allows you to build URIs using a fluent API. - thumbor image resizer - - \ No newline at end of file diff --git a/DotNetThumbor/ThumborImage.cs b/DotNetThumbor/ThumborImage.cs index c768937..a3e9504 100644 --- a/DotNetThumbor/ThumborImage.cs +++ b/DotNetThumbor/ThumborImage.cs @@ -9,7 +9,7 @@ public class ThumborImage { private readonly List watermarks = new List(); - private readonly Dictionary filters = new Dictionary(); + private readonly Dictionary filters = new Dictionary(); private readonly ThumborSigner thumborSigner; @@ -145,15 +145,23 @@ public ThumborImage Grayscale(bool grayscaleImage) /// /// Adds a watermark image to this image. The watermark image can be the output of another thumbor image. See https://github.com/thumbor/thumbor/wiki/Watermark for details. - /// Can be called multiple times with each watermark being included on the base image. The last added watermark + /// Can be called multiple times with each watermark being included on the base image. The last added watermark /// will overlay all previous watermarks if there is an overlap. /// /// URL to the image to use as a watermark. Can be the output of another thumbor image. - /// How many pixels right the watermark should be. - /// How many pixels down the watermark should be. + /// + /// How many pixels right the watermark should be. If the value is 'center' (without the single quotes), the watermark will be centered horizontally. + /// If the value is 'repeat' (without the single quotes), the watermark will be repeated horizontally. + /// If the value is a positive or negative number followed by a 'p' (ex. 20p), it will calculate the value from the image width as percentage. + /// + /// + /// How many pixels down the watermark should be. If the value is 'center' (without the single quotes), the watermark will be centered vertically. + /// If the value is 'repeat' (without the single quotes), the watermark will be repeated vertically. + /// If the value is a positive or negative number followed by a 'p' (ex. 20p), it will calculate the value from the image height as percentage. + /// /// Watermark image transparency 0 = opaque - 100 fully transparent /// The current thumbor image object. - public ThumborImage Watermark(string watermarkImageUrl, int right, int down, int transparency) + public ThumborImage Watermark(string watermarkImageUrl, string right, string down, int transparency) { this.watermarks.Add(string.Format("watermark({0},{1},{2},{3})", watermarkImageUrl, right, down, transparency)); return this; @@ -513,15 +521,26 @@ public ThumborImage Curve(IList> curveAll, IList { var curve = string.Format( "[{0}],[{1}],[{2}],[{3}]", - string.Join(",", curveAll.Select(x => string.Format("({0},{1})", x.Item1, x.Item2))), - string.Join(",", curveRed.Select(x => string.Format("({0},{1})", x.Item1, x.Item2))), - string.Join(",", curveGreen.Select(x => string.Format("({0},{1})", x.Item1, x.Item2))), - string.Join(",", curveBlue.Select(x => string.Format("({0},{1})", x.Item1, x.Item2)))); + string.Join(",", curveAll.Select(x => string.Format("({0},{1})", x.Item1, x.Item2))), + string.Join(",", curveRed.Select(x => string.Format("({0},{1})", x.Item1, x.Item2))), + string.Join(",", curveGreen.Select(x => string.Format("({0},{1})", x.Item1, x.Item2))), + string.Join(",", curveBlue.Select(x => string.Format("({0},{1})", x.Item1, x.Item2)))); this.ReplaceOrAddFilter("curve", curve); return this; } + /// + /// Sets the background layer to the specified color. See https://thumbor.readthedocs.io/en/latest/background_color.html for details. + /// + /// The color name (like in HTML) or hexadecimal rgb expression without the “#” character (see https://en.wikipedia.org/wiki/Web_colors for example). + /// The current thumbor image object. + public ThumborImage BackgroundColor(string color) + { + this.ReplaceOrAddFilter("background_color", color); + return this; + } + /// /// An alias to ToUrl /// @@ -586,7 +605,7 @@ private string FormatUrlParts() { urlParts.Add(this.trim == Thumbor.ImageTrimOption.BottomRight ? "trim:bottom-right" : "trim"); } - + if (!string.IsNullOrEmpty(this.cropCoordinates)) { urlParts.Add(this.cropCoordinates); diff --git a/DotNetThumborTest/DotNetThumborTest.csproj b/DotNetThumborTest/DotNetThumborTest.csproj index 41af3af..9d34595 100644 --- a/DotNetThumborTest/DotNetThumborTest.csproj +++ b/DotNetThumborTest/DotNetThumborTest.csproj @@ -1,5 +1,6 @@  + Debug @@ -124,6 +125,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. +