Kinu is the server that resizing images. Inspired by cookpad's image server Tofu.
It's development now for first alpha release.
- ImageMagick >= 6.8.9-9 && < 7.0.0
# Please to Install the ImageMagick before this
go get github.com/tokubai/kinu
or
docker pull tokubai/kinu:1.0.0.alpha13
$ export KINU_LOG_LEVEL=info
$ export KINU_RESIZE_ENGINE=ImageMagick
$ export KINU_STORAGE_TYPE=File
$ export KINU_FILE_DIRECTORY=/tmp/kinu
$ kinu
INFO[0000] setup resize engine resize_engine_type=ImageMagick
INFO[0000] setup storage storage_type=File
INFO[0000] [starting kinu on 127.0.0.1:8080]
$ curl http://localhost:8080/version
$ docker run tokubai/kinu:1.0.0.alpha13
INFO[0000] setup resize engine resize_engine_type=ImageMagick
INFO[0000] setup storage storage_type=File
INFO[0000] [starting kinu on 0.0.0.0:80]
$ curl http://localhost/version
require 'kinu'
Kinu::Resource.new(:foods, 1).upload(open('/path/to/image.jpg'))
$ curl -X POST -F id=1 -F name=foods -F image=@/path/to/image http://localhost/upload
require 'kinu'
require 'open-uri'
uri = Kinu::Resource.new(:foods, 1).uri(width: 280, height: 300) #<URI::HTTP http://localhost/images/foods/w=280,h=300/1.jpg>
open(uri).read
$ curl http://localhost/images/foods/w=280,h=300/1.jpg
require 'kinu'
Kinu::Sandbox.upload(open('/path/to/image.jpg')) #<Kinu::Sandbox:0x007fdf92bdc490 @id="db4f1509-e2f5-40a7-9944-a6b0024f2a24", @name="__sandbox__">
$ curl -X POST -F image=@/path/to/image http://localhost/sandbox
require 'kinu'
Kinu::Sandbox.upload(open('/path/to/image.jpg')).attach_to(:foods, 1) #<Kinu::Resource:0x007fdf92b44a00 @id="1", @name="foods">
$ curl -X POST -F sandbox_id=db4f1509-e2f5-40a7-9944-a6b0024f2a24 -F name=foods -F id=1 http://localhost/sandbox
now writing
now writing
name | required | default value | valid value type | note |
---|---|---|---|---|
KINU_BIND | ☓ | 127.0.0.1:80 | IP:PORT / unix domain socket path / Einhorn(einhorn@[num]) / FileDescripter(fd@[num]) | Compliance with the specifications of the goji/bind package. |
KINU_DEBUG | ☓ | none | true | enable pprof |
KINU_RESIZE_ENGINE | ◯ | none | ImageMagick | |
KINU_LOG_LEVEL | ◯ | none | panic / fatal / error / warning / info / debug | |
KINU_LOG_FORMAT | ☓ | text | ltsv / json / text | |
KINU_RESIZE_WORKER_MODE | ☓ | none | true | |
KINU_RESIZE_WORKER_MAX_SIZE | ☓ | cpu num * 10 | Integer | |
KINU_RESIZE_WORKER_WAIT_BUFFER | ☓ | KINU_RESIZE_WORKER_SIZE * 3 | Integer | |
KINU_STORAGE_TYPE | ◯ | none | File / S3 | |
KINU_FILE_DIRECTORY | ☓ | none | directory path | When the File has been set in a KINU_STORAGE_TYPE \ you must set this variable. |
KINU_S3_REGION | ☓ | none | AWS Region | When the S3 has been set in a KINU_STORAGE_TYPE \ you must set this variable. |
KINU_S3_BUCKET | ☓ | none | Amazon S3 bucket | When the S3 has been set in a KINU_STORAGE_TYPE \ you must set this variable. |
KINU_S3_BUCKET_BASE_PATH | ☓ | none | ||
AWS_ACCESS_KEY_ID | △ | none | Compliance with the specifications of the aws-sdk-go package. | |
AWS_SECRET_ACCESS_KEY | △ | none | Compliance with the specifications of the aws-sdk-go package. |
now writing
Bug reports and pull requests are welcome on GitHub at https://github.com/tokubai/kinu
- Issei Naruta
- The Tofu, which inspired Kinu, is created by him.