Comparing version 0.0.2 to 0.0.3
@@ -20,3 +20,4 @@ var EventEmitter = require('events').EventEmitter | ||
var f = path.join(dir, new Buffer(id).toString('base64') + '.jpg') | ||
var file = new Buffer(''+id).toString('base64') + '.jpg' | ||
var f = path.join(dir, file) | ||
@@ -37,5 +38,7 @@ function serve(err) { | ||
if (exists) { | ||
debug('hit %s', file) | ||
return serve() | ||
} | ||
debug('miss %s', file) | ||
var emitter = updating[f] | ||
@@ -42,0 +45,0 @@ |
var url = require('url') | ||
var debug = require('debug')('adaptive:main') | ||
var express = require('express') | ||
@@ -30,2 +31,4 @@ var request = require('request') | ||
if (!size) return res.status(400).send('Invalid size requested.') | ||
// add the query string (if present) | ||
@@ -49,2 +52,4 @@ var qs = url.parse(req.url).query | ||
debug('fetching %s', src) | ||
// the image is not in the cache yet, fetch it | ||
@@ -51,0 +56,0 @@ request({ url: src, encoding: null }, function(err, response, data) { |
{ | ||
"name": "adaptive", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Simple adaptive image server based on smartcrop.js", | ||
@@ -5,0 +5,0 @@ "author": "Felix Gnass <fgnass@gmail.com>", |
@@ -34,3 +34,3 @@ ## adaptive | ||
The following URL will generate a 200x200 crop from the example image shown above: | ||
http://localhost:3000/unsafe/200x200/https://farm6.staticflickr.com/5189/5682480447_2b7f74b4bd_b.jpg | ||
[http://localhost:3000/unsafe/200x200/https://farm6.staticflickr.com/5189/…](http://localhost:3000/unsafe/200x200/https://farm6.staticflickr.com/5189/5682480447_2b7f74b4bd_b.jpg) | ||
@@ -73,2 +73,20 @@ ## Security | ||
### Deploying to Heroku/dokku | ||
The easiest way to deploy _adaptive_ to Heroku or a dokku instance is to create | ||
an empty project with nothing but a `package.json`: | ||
```json | ||
{ | ||
"name": "my-adaptive-images", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
"start": "adaptive" | ||
}, | ||
"dependencies": { | ||
"adaptive": "*" | ||
} | ||
} | ||
``` | ||
## Logging | ||
@@ -75,0 +93,0 @@ |
Sorry, the diff of this file is not supported yet
9846
157
116