CF.Services.ImageService 1.0.2

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

// Install CF.Services.ImageService as a Cake Tool
#tool nuget:?package=CF.Services.ImageService&version=1.0.2

CODER FOUNDRY

Hi guys this is Jason Twichell from Coder Foundry and I am making this simple package available to you for the following reasons:

  • I wanted to introduce the concept of downloading and using a NuGet package.

    A NuGet package represents someone else's work that has been made available to you as a download.

  • I like to encourage new students to write and publish their own NuGet packages.

    A custom and visible NuGet package is something that can be included in your Portfolio of work.

Curriculum Support

The following items have been included for you in this NuGet package

  • ICFImageService Interface

    public interface ICFImageService
    {
      Task<byte[]> EncodeImageAsync(IFormFile file);
      Task<byte[]> EncodeImageAsync(string fileName);
      string DecodeImage(byte[] data, string type);
    
      bool ValidateImageType(IFormFile file);
      bool ValidateImageType(IFormFile file, List<string> fileTypes);
    
      bool ValidateImageSize(IFormFile file, int maxSize);
    
      string ContentType(IFormFile file); 
      int Size(IFormFile file);
    }
    
  • BasicImageService Class (not shown)

Example

using CFImageService;
...
public void ConfigureServices(IServiceCollection services)
{
   //Register our Image Service            
   services.AddScoped<ICFImageService, BasicImageService>();
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
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.0.2 760 4/28/2021
1.0.1 671 4/28/2021
1.0.0 600 4/28/2021

This is a simple tool that can be helpful if you want to store an IFormFile in a database and later retrieve it for display. The images are stored as a byte array and displayed as a base64 string.