Giter Site home page Giter Site logo

exdtech.imageserver's Introduction

ExdTech.ImageServer

This is the image server used by Exd Pic. It is live at images.exdpic.com. It is a simple image server that uses a REST API. It is designed to be easy to extend and configure.

Functions

  • High quality image resizing and compression.
  • Throws Bad Request if non-images are uploaded or if limits on accepted filesize or dimensions are exceeded.
  • Reencodes images as jpegs. (This behaviour should not be removed without understanding and consideration of the security aspect.)
  • Stores images to Azure Blob Storage. (Or elsewhere with your own implementation of IImageStore.)

Processing

It uses Magick.Net for processing, which is a .net wrapper for ImageMagick. The quality of processed images is very good.

Set-up

It is set up to use an Azure blob store for the images and SQL server for image information. You can change it to use different stores by using a new implementation of IImageStorageService or IInfoStorageService respectively.

The following packages are available on nuget to facilitate client development:

Configuration

Configure appsettings.json. You must configure an image store and an info store for it to work.

  // Binds to ExdTech.ImageServer.Contract.ImageProcessingOptions.
  "ImageProcessingConfig": {
    "MaxWidthInPixels": 1080,   // Images are scaled down if this is exceeded. 
    "MaxHeightInPixels": 1080,  // Images are scaled down if this is exceeded.
    "MaxFileSizeNotCompressedInBytes": 200000,  // Images are compressed if this is exceeded.
    "MaxFileSizeAcceptedInBytes": 5000000,      // Images are rejected if this is exceeded.
    "CompressionQualityPercentage": 80          // Jpg compression quality to use if compressing.
  },

  "ImageStoreConnectionString": "<Connection string>",
  "ContainerClient": "<Container>", // Container must already exist

Storage

By default it uses Azure Blob Storage. You can configure this by setting "ImageStoreConnectionString" and "ContainerClient" configuration values. Alternatively you can replace it by implementing the IImageStorageService interface.

Authentication/Authorization

It uses Azure AD B2C authentication for POSTs. You will probably want to remove or change this. It can be turned off by removing the Authorize(Policy = "access") attribute from the POST method in the API contrller.

API and Schema

It uses JSON. See the swagger documentation for the live version at https://images.exdpic.com/index.html.

/{id} GET

Get an object containing the info and the image serialized as a byte array

/images/{id} GET

Get the image file. /images/{id}.jpeg and /images/{id}.jpg will also work.

/info/{id} GET

Get the image info only.

/ POST

Send the image serialized as a byte array as well as information about the image.

Licence

MIT

exdtech.imageserver's People

Contributors

peterdongan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.