mini-image-server v1.0.2
during# mini-image-server
This project is a middle ware for express that optimizes and provides image that are down to facilitate fast page loading
Install
npm i -s mini-image-server
Example
const express = require('express')
const path = require('path')
const app = express()
const mini = require('mini-image-server');
app.use(mini(path.join(__dirname, 'images')));
//etc...
Docs
require('mini-image-server')(path, opts, callback);
Description
creates a new middleware route
returns: \
Parameters
path (required)
This is the file path that you want to scale and serve images from
opts (optional)
Options for the scaled image creation
factor (optional)
2
The factor that you want the image to be scaled by on each interval. (ie. 2: half, quarter, eight)
min (optional)
400
The minimum size that images will be scaled down to (width or height)
interaction (optional)
4
The maximum amount of times an image will be scaled down
forceRegen (optional)
false
Force the recreation of all images even if they already are scaled
interpolation (optional)
'nearest'
The algorithm that will be used to scale images down (options are:
nearest
cubic
mitchell
lanczos2
lanczos3
)
callback (optional)
callback function to run after all of the images have been scaled
- err
any error that occurred during run time. (undefined if no error occurred)