Skip to content

Commit 0808b57

Browse files
Update ImageSharp.Web
1 parent 4250a95 commit 0808b57

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed

articles/imagesharp.web/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Introduction
22

33
### What is ImageSharp.Web?
4-
ImageSharp.Web is a high performance ASP.NET Core Middleware built on top of ImageSharp that allows the processing and caching of image requests via a simple API.
4+
ImageSharp.Web is a high performance ASP.NET 6 Middleware built on top of ImageSharp that allows the processing and caching of image requests via a simple API.
55

66
ImageSharp.Web is designed from the ground up to be flexible and extensible. The library provides API endpoints for common image processing operations and the building blocks to allow for the development of additional extensions to add image sources, caching mechanisms or even your own processing API.
77

88
### License
9-
Imagesharp.Web is licensed under under the terms of [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0). Commercial support licensing options are available in addition to this license, see https://sixlabors.com/pricing for details.
9+
ImageSharp.Web is licensed under the terms of the [Six Labors Split License, Version 1.0](https://github.com/SixLabors/ImageSharp.Web/blob/main/LICENSE). See https://sixlabors.com/pricing for commercial licensing details.
1010

1111
### Installation
1212

articles/imagesharp.web/processingcommands.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The following processors are built into the middleware. In addition extension po
1212
Allows the resizing of images.
1313

1414
>[!NOTE]
15-
>In V2 this processor will automatically correct the order of dimensional commands based on the presence of EXIF metadata indicating rotated (not flipped) images.
15+
>In V3 this processor will automatically correct the order of dimensional commands based on the presence of EXIF metadata indicating rotated (not flipped) images.
1616
>This behavior can be turned off per request.
1717
1818
``` bash
@@ -120,4 +120,49 @@ private Func<ImageCommandContext, byte[], Task<string>> onComputeHMACAsync = (co
120120

121121
Users can replicate that key using the same @SixLabors.ImageSharp.Web.CaseHandlingUriBuilder and @SixLabors.ImageSharp.Web.HMACUtilities APIs to generate the HMAC hash on the client. The hash must be passed via a command using the @SixLabors.ImageSharp.Web.HMACUtilities.TokenCommand constant.
122122

123-
Any invalid matches are rejected at the very start of the processing pipeline with a 400 HttpResponse code.
123+
Any invalid matches are rejected at the very start of the processing pipeline with a 400 HttpResponse code.
124+
125+
## ImageTagHelper
126+
127+
ASP.NET tag helpers are useful because they provide a more natural syntax for creating HTML elements in server-side code. They allow developers to create HTML elements in a way that is similar to how they would write HTML markup in a Razor view.
128+
129+
Some of the benefits of using tag helpers include:
130+
131+
1. Improved readability: Tag helpers make it easier to understand the purpose of the code by providing a clear and concise syntax that is closer to HTML.
132+
2. Reduced complexity: Tag helpers simplify the creation of complex HTML elements by reducing the amount of boilerplate code needed.
133+
3. Type safety: Tag helpers are strongly typed, which means that the compiler can catch errors at compile time rather than at runtime.
134+
4. Testability: Tag helpers make it easier to unit test server-side code by providing a cleaner separation of concerns between the server-side code and the HTML markup.
135+
5. Code reuse: Tag helpers can be used to encapsulate commonly used HTML elements, making it easier to reuse code across multiple views and pages.
136+
137+
Overall, ASP.NET tag helpers provide a more efficient and maintainable way to create HTML elements in server-side code.
138+
139+
ImageSharp.Web v3.0.0 comes equipped with a custom tag helper that allows the generation of all the commands supported by the middleware in an easily accessible manner. This includes automatic generation of HMAC command tokens.
140+
141+
>[!NOTE]
142+
>Using @SixLabors.ImageSharp.Web.TagHelpers.ImageTagHelper is the recommended way to generate processing commands.
143+
144+
To use @SixLabors.ImageSharp.Web.TagHelpers.ImageTagHelper, add the following imports command to `_ViewImports.cshtml` in your project.
145+
146+
```html
147+
@addTagHelper *, SixLabors.ImageSharp.Web
148+
```
149+
150+
All ImageSharp.Web commands are strongly typed and prefixed with `imagesharp` to namespace them against potentially conflicting commands. Visual Studio intellisense with automatically provide guidance
151+
once you start typing. For example, the following markup...
152+
153+
```html
154+
<img
155+
src="sixlabors.imagesharp.web.png"
156+
imagesharp-width="300"
157+
imagesharp-height="200"
158+
imagesharp-rmode="ResizeMode.Pad"
159+
imagesharp-rcolor="Color.LimeGreen" />
160+
```
161+
162+
Will generate the following command when HMAC is enabled.
163+
164+
```bash
165+
/sixlabors.imagesharp.web.png?width=300&height=200&rmode=Pad&rcolor=32CD32FF&hmac=21f93e41021df0d3f88b5e2a8753bb273f292598e1511df67ec7cfb63f0b2994
166+
```
167+
168+
The @SixLabors.ImageSharp.Web.TagHelpers.ImageTagHelper type is unsealed so that you can inherit the type and support your own custom commands.

ext/ImageSharp

Submodule ImageSharp updated 2170 files

ext/ImageSharp.Web

Submodule ImageSharp.Web updated 196 files

0 commit comments

Comments
 (0)