HNHacker News
TopNewBestAskShowJobs

buaazp

4 karma · joined September 9, 2014

submissionscomments
buaazp··on Zimg – A lightweight and high-performance image storage and processing system
Of course. The documents of zimg is written in Chinese so you don't know how to use.

1. Using curl and multiform way can post file to zimg and will return a html result:

curl -F "blob=@testup.jpeg;type=image/jpeg" "http://127.0.0.1:4869/upload"

If you don't like upload files via multiform way, you can use raw post way. Use this command to upload image via raw post:

curl -H "Content-Type:jpeg" --data-binary @testup.jpeg "http://127.0.0.1:4869/upload"

You need tell zimg a header "Content-Type", the value is the type of image. This way will get a json result and the error message is in the table below:

{"ret":false,"error":{"code":0,"message":"Internal error."}} {"ret":false,"error":{"code":1,"message":"File type not support."}} {"ret":false,"error":{"code":2,"message":"Request method error."}} {"ret":false,"error":{"code":3,"message":"Access error."}} {"ret":false,"error":{"code":4,"message":"Request body parse error."}} {"ret":false,"error":{"code":5,"message":"Content-Length error."}} {"ret":false,"error":{"code":6,"message":"Content-Type error."}} {"ret":false,"error":{"code":7,"message":"File too large."}}

2. Upload and download access control. Just modify conf file like this:

upload_rule = 'allow 127.0.0.1;allow xx.xx.xxx.xxx/xx' download_rule = 'allow all'

The conf rule is like nginx.

3. Sorry for missing English documents.

buaazp··on Zimg – A lightweight and high-performance image storage and processing system
Interesting requirements. You can send me an email with more details, I will try to implement them. zp@buaa.us
buaazp··on Zimg – A lightweight and high-performance image storage and processing system
Users can choose which storage to use in config file. Beansdb for memcached protocol and SSDB for redis protocol. SSDB is an alternative to Redis. Or you can use any other storage backend which is using these two protocols.