Giter VIP home page Giter VIP logo

sharp-imageproxy's Introduction

sharp-imageproxy

Sharp serverless imageproxy which is based on Dockerfile. This project can be deployed with zeit.co/now

Inspired

This project is inspired by serverless-image-proxy which runs in AWS Lambda. Its converted to run on micro and can be deployed as Dockerfile with serverless-docker

Notes

  • Images are cropped before they are resized
  • Cropping starts from left-top corner

Syntax

URL: DOMAIN / VERSION / PROJECT_ID / FILE_SECRET / [ CROP / ] RESIZE [ / NAME ]

Resize

Format: [ X ] x [ Y ]

  • 500x300: Fit into 500px x 300px rectangle
  • 500x300!: Forced resize
  • 500x: Resize to 500px width maintaining aspect ratio
  • x300: Resize to 300px height maintaining aspect ratio

Resize + Smartcrop

Format: [ X ] x [ Y ]**[crop]

  • All resize options
  • 300x300cc: Rectangle 300x300 and cropped centred
  • 300x300catt: Rectangle 300x300 and cropped with strategy attention
  • 300x300centro: Rectangle 300x300 and cropped with strategy enttropy

Allowed cropped options:

[cc==centre][cn==north][cne==northeast][ce==east][cse==southeast][cs==south][csw==southwest][cw==west][cnw==northwest][centro==strategy.entropy][catt==strategy.attention]

Crop

Format: X x Y : WIDTH x HEIGHT

  • 0x0:400x400: Crops the image taking the first 400x400 square

Name

Name of image to improve indexing of images with search engines.

Supported extensions:

  • png
  • jpg
  • jpeg
  • svg
  • gif
  • bmp
  • webp

Development

npm install
npm run dev

Deploy

With zeit.co/now

You need to place a now.json inside of your repo

{
  "public": false,
  "type": "docker",
  "features": {
    "cloud": "v2"
  },
  "alias": [
    "your-now-alias.example.com"
  ],
  "files":[
    "dist",
    "Dockerfile",
    "package.json",
    "package-lock.json",
    "tsconfig.json"
  ]
}

A simple deploy script for now

npm run deploy

sharp-imageproxy's People

Contributors

dohomi avatar

Stargazers

 avatar

Watchers

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