Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esnunes/imagina-middleware
Express middleware to dynamically resize images based on Imagina Library
https://github.com/esnunes/imagina-middleware
Last synced: about 2 months ago
JSON representation
Express middleware to dynamically resize images based on Imagina Library
- Host: GitHub
- URL: https://github.com/esnunes/imagina-middleware
- Owner: esnunes
- License: mit
- Created: 2013-12-15T21:33:27.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-15T21:34:07.000Z (about 11 years ago)
- Last Synced: 2024-10-11T01:54:41.998Z (3 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# imagina-middleware
Express middleware to dynamically resize images based on [Imagina](https://github.com/esnunes/imagina) Library.
## Examples
```js
var express = require('express');
var path = require('path');var app = express();
app.configure(function() {
var conf = {
root: path.join(__dirname, 'public/imgs'),
resolutions: ['800x600', '1024x768']
};
app.use('/imgs/', require('imagina-middleware')(conf));
app.use(express.static(path.join(__dirname, 'public')));
});app.listen(8080);
``````js
var express = require('express');
var path = require('path');var app = express();
app.configure(function() {
var conf = {
root: path.join(__dirname, 'public/imgs')
};
app.use('/imgs/', require('imagina-middleware')(conf));
app.use(express.static(path.join(__dirname, 'public')));
});app.listen(8080);
``````js
var express = require('express');
var path = require('path');var app = express();
app.configure(function() {
var conf = {
imagina: { workers: 3 },
root: path.join(__dirname, 'public/imgs')
};
app.use('/imgs/', require('imagina-middleware')(conf));
app.use(express.static(path.join(__dirname, 'public')));
});app.listen(8080);
``````js
var express = require('express');
var path = require('path');
var Imagina = require('imagina');var app = express();
app.configure(function() {
var im = new Imagina();var conf = {
imagina: im,
root: path.join(__dirname, 'user-files/imgs')
};
app.use('/user-imgs/', require('imagina-middleware')(conf));
app.use('/user-imgs/', express.static(path.join(__dirname, 'user-files')));var conf = {
imagina: im,
root: path.join(__dirname, 'system-files/imgs')
};
app.use('/system-imgs/', require('imagina-middleware')(conf));
app.use('/system-imgs/', express.static(path.join(__dirname, 'system-files')));
});app.listen(8080);
```