Imagine is a real-time image processing and storage host built in
node.js. Usually, image hosts have to download,
transform, and re-serve images as discreet operations. Imagine pools these
tasks and streams the results back as soon as possible using a combination
of node's events.EventEmitter
and HTTP transfer-encoding: chunked
.
Download the package to a local folder, then run:
$ npm install
You can then start the server (after setting up the config) with:
$ npm start
Uploading images is really easy. Simply name the file and pass in its source
URL:
http://localhost:8101/cat?source=http://funny.com/cat_image.jpg
Once you've uploaded an image, you can retrieve it later using its name:
http://localhost:8101/cat
Imagine ships with Imagine-Magick to allow basic transformations on an image just by changing its URL. For example:
http://localhost:8101/cat/resize/250x200/blur/5/paint/5/
Imagine has three different image storage options included by default:
- Imagine-File - Local file storage
- Imagine-Cloudfiles - Rackspace Cloud Files
- Imagine-S3 - Amazon S3
For example, you can switch to S3 by editing your config as such:
"storage": "imagine-s3",
"imagine-s3": {
"key": "KEY",
"secret": "SECRET",
"bucket": "mybucket"
}
Visit each storage module's github page for more information.
Imagine was built to be modular and offers simple ways to extend its default configuration to include all types of operations and data stores, tailoring the image host to your specific needs. Look at the Wiki for more information.
You don't want to host an open image server to the world. Neither do we. For
that, Imagine handles hmac_sha1
shared key signing. If you set a signedKey
option in your config, source
requests will only be allowed when the request
is also passed a sign
parameter correspending to the hmac_sha1
hash of the
source
URL and your signedKey
. Like so:
hmac_sha1(source, signedKey);
Imagine uses Winston for logging. You can change the default Console implementation by editing the config. For instance, the "File" transport:
"logging": [
{
"type": "File",
"filename": "somefile.log"
}
]
Statsd support is also included. To turn it on, add a segment to your config:
"statsd": {
"host": "xxx",
"port": 123,
"prefix": "some.prefix."
}
Imagine is freely distributed under the MIT License. See LICENSE for more details.