ImageThumbnail.AspNetCore.Middleware
1.0.1
dotnet add package ImageThumbnail.AspNetCore.Middleware --version 1.0.1
NuGet\Install-Package ImageThumbnail.AspNetCore.Middleware -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ImageThumbnail.AspNetCore.Middleware" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImageThumbnail.AspNetCore.Middleware --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ImageThumbnail.AspNetCore.Middleware, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ImageThumbnail.AspNetCore.Middleware as a Cake Addin #addin nuget:?package=ImageThumbnail.AspNetCore.Middleware&version=1.0.1 // Install ImageThumbnail.AspNetCore.Middleware as a Cake Tool #tool nuget:?package=ImageThumbnail.AspNetCore.Middleware&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Image Thumbnail middleware for ASP.NET Core
A middleware to serve image thumbnails with disk caching.
https://github.com/osprakash/Imagethumbnail-aspnetcore
Install NuGet Package
Using Visual Studio
Dependencies
→ Manage NuGet Packages...
→ Search and install ImageThumbnail.AspNetCore.Middleware
Using dotnet command
dotnet add package ImageThumbnail.AspNetCore.Middleware
Using Package Manager
Install-Package ImageThumbnail.AspNetCore.Middleware
Setup and configure
Open your Startup.cs
and configure the middleware in the Configure
method.
Startup.cs
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
ImageThumbnailOptions options = new ImageThumbnailOptions("Gallery", "Thumbnails");
options.ImageQuality = 75L;
app.UseImageThumbnail(options);
app.UseMvc();
}
}
_Sample.cshtml (for ASP.NET Core MVC)
Pass size parameter as query string in image urls.
...
<div class="item">
<img src="~/Gallery/1.jpg?size=256x256" />
<img src="~/Gallery/2.jpg?size=512" />
<img src="~/Gallery/3.jpg?size=full" />
<img src="~/Gallery/4.jpg" />
</div>
...
Options
The ImageThumbnailOptions
are pretty simple.
- ImagesDirectory: Relative folder path containing your images. This folder should be at website root directory.
- CacheDirectoryName: Directory name of cache folder. A sub directory with this name will be created for caching. For example, Gallery.thumbs
- ThumbnailBackground: This property defines background color for thumbnail. Default value is
White
- ImageQuality: This property is used to customize the quality of thumbnails generated. Default value is
90
- DefaultSize: This property controls default size of thumbnails when no size passes via query string. Default value is
256x256
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.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.FileProviders.Physical (>= 3.1.0)
- System.Drawing.Common (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 1,036 | 1/11/2020 |
Release