Coder Social home page Coder Social logo

crops's Introduction

Crops

Simple thumbnail generation server

Clone & install dependencies

sudo apt-get install imagemagick graphicsmagick
git clone [email protected]:gnuns/crops.git
cd crops/
npm install

Usage:

Set the .env variables:

PORT=1337
BASE_SERVER=http://cdn.example.com/

Run!

npm start

To crop the image: http://cdn.example.com/blah/awsome/potatoe.jpg

You just have to access http://localhost:1337/crop/200/400/blah/awsome/potatoe.jpg

You can also set the crop gravity: http://localhost:1337/crop/200/400/blah/awsome/potatoe.jpg?gravity=North or http://localhost:1337/crop/200/400/blah/awsome/potatoe.jpg?gravity=2

And quality (1-100): http://localhost:1337/crop/200/400/blah/awsome/potatoe.jpg?quality=70

By default, Crops use quality = 100 and smartcrop to define the best gravity

Valid gravity values:

Code Name
0 Center
1 NorthWest
2 North
3 NorthEast
4 West
5 East
6 SouthWest
7 South
8 SouthEast
9 Smart (default)

Live demo

I setup a live demo on heroku with BASE_SERVER param as http://, so you can view a cropped version of any image on the web using the URL without http://

Address: https://crops.herokuapp.com/crop/

Example:

Original cat

Image: http://68.media.tumblr.com/4e097c1aba3644c09121b28c3fc2d468/tumblr_mgtkitzs2I1qlp8dho1_1280.jpg

Square cat

70% quality 300x300 image: https://crops.herokuapp.com/crop/300/300/68.media.tumblr.com/4e097c1aba3644c09121b28c3fc2d468/tumblr_mgtkitzs2I1qlp8dho1_1280.jpg?quality=70

credits

inspired by zooniverse/static-crop

crops's People

Contributors

gnuns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

crops's Issues

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.