Jin.FileServer
2.1.0
dotnet add package Jin.FileServer --version 2.1.0
NuGet\Install-Package Jin.FileServer -Version 2.1.0
<PackageReference Include="Jin.FileServer" Version="2.1.0" />
paket add Jin.FileServer --version 2.1.0
#r "nuget: Jin.FileServer, 2.1.0"
// Install Jin.FileServer as a Cake Addin #addin nuget:?package=Jin.FileServer&version=2.1.0 // Install Jin.FileServer as a Cake Tool #tool nuget:?package=Jin.FileServer&version=2.1.0
Jin.FileServer
Justify your images on you file server dynamicly.
Demo
1. How to use
1.1 Installation
Install-Package Jin.FileServer
Gihub address: https://github.com/jinchou/Jin.FileServer
1.2 Configuration
app.UseJinFileServer(env);
It's that simple, one line of code is fixed.
1.3 Experience a hand
Make sure there is an image in the project wwwroot folder.
Suppose the image address is:
Https://localhost:44370/upload/201806/1.png
Then, use a browser to access:
Https://localhost:44370/upload/201806/1.png_200x200.png
Note: This will be in the original directory under the name of 1.png_200x200.png, the size of the 200x200 png file, Then output to the client!
Visit this address again, this image will be output directly to the client browser as it already exists.
2. Image generation parameters
An address hosted by JinFileServer consists of: original image address + image generation parameters.
2.1 Image generation parameter format:
_width x height converted format
Such as: _200x200.png The full address is as follows: Https://localhost:44370/upload/201806/1.png_200x200.png
2.2 Advanced Skills
_200.png means to generate a picture with a width and height of 200, and ensure that the background color is automatically filled without distortion.
_200x.png means to generate a picture with a width of 200 and a height that is automatically scaled.
_x200.png indicates that the height is 200 and the width is automatically scaled.
_200x480.png means to generate a picture with a width of 200 and a height of 480, and ensure that the background color is automatically filled without distortion.
3. Configuration instructions
3.1 Specify image extensions
pp.UseJinFileServer(env, opt => {
opt.ImageFormats= new List<string> {
".bmp", ".gif", ".jpg", ".jpeg", ".png"
};
});
Note: It is also the default value. The extension of the above configuration will be automatically managed by JinFileServer when accessing. When the accessed address has the above suffix and has image generation parameters, JinFileServer will automatically generate the specified image.
3.2 Specify the image size that can be generated
app.UseJinFileServer(env, opt => {
opt.ImageSizes = new List<Size>
{
//80, 100, 200, 480, 500, 600, 800
New Size(80,80),
New Size(100,100),
New Size(200,200),
New Size(480,480),
New Size(500,500),
New Size(600,600),
New Size(800,800),
};
});
Note: It is also the default value. There is no configured size, JinFileServer will not do any processing when accessing.
Upgrade history
v2.1
Internal algorithm adjustment, doc optimization.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.1
- Microsoft.AspNetCore.All (>= 2.1.1)
- SixLabors.ImageSharp (>= 1.0.0-beta0004)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.