Giter VIP home page Giter VIP logo

spacechop's Introduction

SpaceChop is a Docker container for processing your images through HTTP requests.

๐Ÿ”’ Secure - Dont allow everyone to create arbitrary image transformations and overload your server.

๐Ÿ“ฆ Storage - Store original and transformed images on the infrastructure you are already using. For example Amazon S3, HTTP server, or local volume.

๐Ÿ‘จโ€๐Ÿ’ป For developers - Set up available transformations via yaml files.

At spacechop.com, you can get for the hosted solution of SpaceChop which includes CDN, storage, caching, database, statistics and analytics for your service.

To get started with SpaceChop, go to our documentation website.

Installation

The recommended way to use SpaceChop is via docker-compose:

docker-compose.yml

version: '3'
services:
  spacechop:
    container_name: spacechop
    image: spacechop/spacechop:latest
    ports:
      - 8080:3000
    volumes:
      - ./config.yml:/config.yml

config.yml

paths:
  - /:preset/:image(.*)
sources:
  - http:
      root: https://upload.wikimedia.org/wikipedia/commons/:image
presets:
  # fill 200x200 with type jpeg and compress with quality 0.9
  t_200:
    steps:
      - $fill:
          width: 200
          height: 200
      - $format:
          type: jpeg
      - $compress:
          quality: 90
# start the service using docker-compose
docker-compose up -d

# check the logs for help with your configuration and see what's happening
docker-compose logs -f spacechop

Go to http://localhost:8080/t_200/c/c4/Photo_Wallet_product.jpg in your browser and you should see an image fetched from Wikimedia and transformed with the above preset t_200. You just successfully transfomed your first image using SpaceChop!

Getting started

You will at least need a path, source and preset to get started.

paths and sources

Paths and sources are interlinked and work together using path-to-regex with support for ()-matching groups. Use the path express-route-tester with version 2.0.0 to see what works.

Basically how it works is that the path you request at http://localhost:8080/t_200/your-unique-path/with-slashes/to-and-image-url.jpg will look through your sources until it finds an image for your root url (if you are using the http source).

i.e.
http://localhost:8080/t_200/your-unique-path/with-slashes/to-and-image-url.jpg will in the above configuration look at: http://commons.wikipedia.org/your-unique-path/with-slashes/to-and-image-url.jpg

Notice the usage of :image in paths and sources, you can change this to whatever makes sense for you in your matching. You can use your own variable names and matching in your sources.

Each source has its own set of configuration to be able to lookup and download originals. You can read more about each source in our documentation.

presets

As you might have seen there is a :preset variable in the path in the example configuration above, this is the only required variable in path that there is, and this will match the exact name of your preset in the configuration as you might have guessed.

In a preset there are steps which are composed of a list of operations with their unique set of options. You can read more about each operation in our documentation.

Contributing

Build Status codecov Greenkeeper badge PRs Welcome

Read the SpaceChop Contributor Guidelines.

Running tests locally:

sh test.sh

or manually using docker-compose

docker-compose up -d --build
docker-compose exec spacechop sh -c "npm run test:watch"

This project uses TypeScript for static typing and TSLint for linting. You can get both of these built into your editor with no configuration by opening this project in Visual Studio Code, an open source IDE which is available for free on all platforms.

spacechop's People

Contributors

ericwenn avatar greenkeeper[bot] avatar ppa-covis avatar rjnienaber avatar timbrandin 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.