https://github.com/paralect/img-fly
Docker based service for uploading and transforming images on the fly 🦋
https://github.com/paralect/img-fly
paralect-stack
Last synced: 9 months ago
JSON representation
Docker based service for uploading and transforming images on the fly 🦋
- Host: GitHub
- URL: https://github.com/paralect/img-fly
- Owner: paralect
- License: mit
- Created: 2018-03-30T05:27:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-03T16:36:48.000Z (over 7 years ago)
- Last Synced: 2025-01-21T15:49:21.158Z (11 months ago)
- Topics: paralect-stack
- Language: JavaScript
- Size: 1.59 MB
- Stars: 0
- Watchers: 12
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Img Fly
[](https://github.com/paralect/stack)
[](#contributors)
[](LICENSE)
[](http://makeapullrequest.com)
[](http://product-stack-ci.paralect.com/paralect/img-fly)
[](https://david-dm.org/paralect/img-fly)
[](https://github.com/paralect/img-fly/watchers)
[](https://github.com/paralect/img-fly/stargazers)
[](https://twitter.com/paralect)
[](https://twitter.com/intent/tweet?text=Check%20out%20Img%20Fly%20%F0%9F%A6%8B%20%E2%80%94%20an%20open-source,%20docker%20based%20service%20for%20uploading%20and%20manipulating%20images%20on%20a%20fly%20https://github.com/paralect/img-fly)
Docker based service for uploading and transforming images on the fly 🦋. Based on native, ultra fast [Sharp](http://sharp.pixelplumbing.com/en/stable/performance/#the-task) and [Amazon S3](https://aws.amazon.com/s3/).
## Features
* 🔥️ **Transform images on the fly** Upload image and apply transformation by adding them to the url. Similar to [Cloudinary](https://cloudinary.com/).
* 😍 **Resize, Crop, Face detection** and other image transformations. Based on [Sharp](http://sharp.pixelplumbing.com/en/stable/install/)
* 🙀 **Amazon S3 as file storage** we store original uploads and all transformations over to your S3 bucket.
* 🤗 **Upload directly from client app.** .
* ️⚡️ **Easy to use** Img Fly is a Node.JS based microservice, shipped in Docker container.
* 💰 **Automated S3 storage cleanup.** We cleanup your S3 bucket if file isn't accessed for over 30 days. ImgFly saves your money. *(planned)*
* 👮♂️ **Secure** — we keep all uploads and file access secure by verifying `md5(resourceId,imgFlySecretKey)`. *(planned)*
## Getting Started
### Play around
1. Clone this repo
2. Create `.env` file with Amazon s3 credentials (see [.env.example](./.env.example)).
3. Start a project using `./bin/start.sh`.
4. Navigate to the `http://localhost:3002/` and upload image file.
5. Click on the transformation link and play around with url params.
Extract + Resize example:
`http://localhost:3001/5ac0bb5fab7ce4028e879d03/extract-left_0,top_30,width_400,height_300+resize-width_300/nice_file_name.png`
### Add ImgFly to your project
ImgFly shipped as [Docker container](https://hub.docker.com/r/paralect/img-fly/tags/). If you already using [docker-compose for your project](https://github.com/paralect/docker-compose-starter) it won't take more than 5 minutes to install and start using ImgFly.
You'll need to add following to your docker-compose file. [Full installation and usage guide](./INSTALL.md)
```yml
img-fly:
image: paralect/img-fly:v0.2.2
ports:
- "3003:3001"
environment:
NODE_ENV: "production"
IMG_FLY_AWS_SECRET_KEY: "YOUR AWS SECRET"
IMG_FLY_AWS_ACCESS_KEY: "YOUR AWS ACCESS KEY"
IMG_FLY_AWS_S3_REGION: "YOUR AWS REGION"
IMG_FLY_AWS_S3_BUCKET: "YOUR BUCKET NAME"
IMG_FLY_MONGO_CONNECTION: "mongodb://mongo:27017/img-fly-dev"
IMG_FLY_MONGO_COLLECTION: "img-fly_files"
IMG_FLY_API_URL: "http://localhost:3003"
IMG_FLY_DEBUG: "true"
```
### Supported transformations
1. [Extract](http://sharp.pixelplumbing.com/en/stable/api-operation/#extract)
2. [Resize](http://sharp.pixelplumbing.com/en/stable/api-resize/#resize)
- [Crop](http://sharp.pixelplumbing.com/en/stable/api-resize/#crop)
- [Embed](http://sharp.pixelplumbing.com/en/stable/api-resize/#embed)
- [Max](http://sharp.pixelplumbing.com/en/stable/api-resize/#max)
- [withoutEnlargement](http://sharp.pixelplumbing.com/en/stable/api-resize/#withoutEnlargement)
3. [Extract](http://sharp.pixelplumbing.com/en/stable/api-operation/#extract)
4. [Blur](http://sharp.pixelplumbing.com/en/stable/api-operation/#blur)
5. [toFormat](http://sharp.pixelplumbing.com/en/stable/api-output/#toformat)
6. [Grayscale filter](http://sharp.pixelplumbing.com/en/stable/api-colour/#grayscale)
[All transformations (code)](https://github.com/paralect/img-fly/tree/master/src/service/src/transformations)
Feel free to submit PR's with more transformations. You'll need to implement a function which maps query params to the [sharp](http://sharp.pixelplumbing.com/) function params.
#### Building transfomration query
We use following rules to form query params.
1. `+` is used to combine multiple transformations.
2. `-` is used as separator between transformation name and params.
3. `_` is used to separate param name and param value;
Example of applying extract & resize transformations: `extract-left_0,top_30,width_400,height_300+resize-width_300`
Example of resize and crop: `resize-width_300,height_300+crop-strategy_attention`
## Demo
N/A
## Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
Every release is documented on the Github [Releases](https://github.com/paralect/img-fly/releases) page.
## License
Ship is released under the [MIT License](LICENSE).
## Contributing
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
## Contributors
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
| [
Evgeny Zhivitsa](https://github.com/ezhivitsa)
[💻](https://github.com/paralect/ship/commits?author=ezhivitsa "Code") [📖](https://github.com/paralect/ship/commits?author=ezhivitsa "Documentation") [🤔](#ideas-ezhivitsa "Ideas, Planning, & Feedback") [👀](#review-ezhivitsa "Reviewed Pull Requests") [⚠️](https://github.com/paralect/ship/commits?author=ezhivitsa "Tests") | [
Ihar](https://github.com/IharKrasnik)
[💻](https://github.com/paralect/ship/commits?author=IharKrasnik "Code") [📖](https://github.com/paralect/ship/commits?author=IharKrasnik "Documentation") [🤔](#ideas-IharKrasnik "Ideas, Planning, & Feedback") [👀](#review-IharKrasnik "Reviewed Pull Requests") | [
Andrew Orsich](http://paralect.com)
[💻](https://github.com/paralect/ship/commits?author=anorsich "Code") [📖](https://github.com/paralect/ship/commits?author=anorsich "Documentation") [🤔](#ideas-anorsich "Ideas, Planning, & Feedback") |
| :---: | :---: | :---: |
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!