ImageThumbnailCreator.Core 1.1.3

dotnet add package ImageThumbnailCreator.Core --version 1.1.3                
NuGet\Install-Package ImageThumbnailCreator.Core -Version 1.1.3                
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="ImageThumbnailCreator.Core" Version="1.1.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImageThumbnailCreator.Core --version 1.1.3                
#r "nuget: ImageThumbnailCreator.Core, 1.1.3"                
#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 ImageThumbnailCreator.Core as a Cake Addin
#addin nuget:?package=ImageThumbnailCreator.Core&version=1.1.3

// Install ImageThumbnailCreator.Core as a Cake Tool
#tool nuget:?package=ImageThumbnailCreator.Core&version=1.1.3                

Image Thumbnail Creator .NET Standard 2.0

Short description

  • Create simple thumbnails from images
  • Save the original with the thumbnail version for easy links to full resolution version
  • Downsize large resolution images and compress thumbnails to your desired level

Excellent addition for custom blog sites, local file management, and even a tool to quickly downsize images for your custom content.

  • Original uploaded images can be saved to the file system.

  • Thumbnails will be saved to the file system automatically.

Repository

https://github.com/godfathr/ImageThumbnailCreator.Core

Sample projects

Sample usage

Razor Pages

Index.cshtml

@page
@model IndexModel
@{
    ViewData["Title"] = "Home page";
}

<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Short example to show an implementation of the ImageThumbnailCreator.Core NuGet package.</p>

    <form method="post" enctype="multipart/form-data">
        <input type="file" asp-for="Upload" />
        <input type="submit" />
    </form>
</div>

Index.cshtml.cs

using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System.IO;
using System.Threading.Tasks;

namespace ImageThumbnailCreator.Core.RazorPages.Pages
{
    public class IndexModel : PageModel
    {
        private IWebHostEnvironment _environment;
        private readonly ILogger<IndexModel> _logger;
        private static Thumbnailer _thumbnailer = new Thumbnailer();
        private static string _uploadFolder;

        [BindProperty]
        public IFormFile Upload { get; set; }

        public IndexModel(IWebHostEnvironment environment, ILogger<IndexModel> logger)
        {
            _environment = environment;
            _logger = logger;
            _uploadFolder = Path.Combine(_environment.ContentRootPath, "wwwroot\\uploads");
        }

        public async Task OnPostAsync()
        {
            // if upload directory doesn't exist, create it
            _thumbnailer.CheckAndCreateDirectory(_uploadFolder);

            // Create the thumbnail and save original upload

            // Compression level 90 as optional parameter
            var thumbnailPath = await _thumbnailer.Create(200, _uploadFolder, $"{_uploadFolder}\\originals", Upload, 90L);

            // Compression level 85 if no compression parameter supplied
            //var thumbnailPath = await _thumbnailer.Create(200, _uploadFolder, $"{_uploadFolder}\\originals", Upload);

            _logger.LogInformation($"Successfully uploaded {Upload.FileName} to {thumbnailPath}");
        }
    }
}

https://dotnet.microsoft.com/download/visual-studio-sdks

https://github.com/godfathr/ImageThumbnailCreator.Core/issues

License

https://github.com/godfathr/ImageThumbnailCreator.Core/blob/main/LICENSE

Product 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.

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.1.3 593 9/25/2021
1.0.1 351 9/24/2021

Updated required framework to be .NET Standard 2.0 version of the ImageThumbnailCreator.

Updated example project so no empty file is created by the Razor Page upload form.