Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gravityblast/matryoshka
an image transformation reverse proxy written in elixir
https://github.com/gravityblast/matryoshka
elixir elixir-lang image-reverse-proxy reverse-proxy
Last synced: about 9 hours ago
JSON representation
an image transformation reverse proxy written in elixir
- Host: GitHub
- URL: https://github.com/gravityblast/matryoshka
- Owner: gravityblast
- License: mit
- Created: 2017-05-15T22:18:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-16T08:00:09.000Z (over 7 years ago)
- Last Synced: 2023-04-11T01:05:58.611Z (over 1 year ago)
- Topics: elixir, elixir-lang, image-reverse-proxy, reverse-proxy
- Language: Elixir
- Size: 9.77 KB
- Stars: 18
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Matryoshka
An image transformation reverse proxy written in Elixir.
It is meant to be used with a CDN in front of it, so that
the it processes each image only once during the first request.Internally it uses the `mogrify` command.
## Transformations
You can use a plug-like syntax to specify all the transformations:
```elixir
defmodule MyTransformations do
use Matryoshka.TransformationPlugtransformation Resize
transformation Rotate
transformation Strip
end
```Each transformation is just a behaviour with a transform function:
```elixir
defmodule Resize do
alias Matryoshka.{Command}def transform(%Command{} = cmd, opts) do
opts
|> Map.get("size", "")
|> Integer.parse
|> case do
{size, ""} ->
cmd
|> Command.add_option("-thumbnail", "#{size}x#{size}")
|> Command.add_option("-quality", "80")
_ ->
cmd
end
end
end
```## Usage
```bash
export REMOTE_ROOT="https://s3.amazonaws.com/BUCKET_NAME"
mix run --no-halt
```## TODO
The current repository contains an application that can be run with `mix run --no-halt`.
The plan is to change it so that it can be used as a simple library, and each one can just
use the `TransformationPlug` behaviour.* [ ] Write a TODO list
## Author
[Andrea Franz](http://gravityblast.com)