locator-image-utility
Utility module for providing useful operations regarding handling images.
Install
include it in your project
npm install locator-image-utility
Usage
Regex
// access various regexesvar regex = regex regeximageContentType // or jpg/jpeg regeximageExtension //or jpg/jpeg regexroutePrefix // everything within four slashes
Validation
// get the validationvar validation = validation // route with image payload ... payload: validationbasicImageSchema ...
Image Processing
// create a image processing unitvar imageUtil = image // route with image payload ... var imageProcessor = imageUtil; // request must be a request object from hapi // will return a useful object containing information about the file file = imageProcessor; // will return an object used for saving the picture to couchdb imageProcessor; // will crop the stream according to the values in the **request**. The parameters are used for resizing stream = imageProcessor; stream; ...
Sizes
The following sizes are used to request a picture with the query ```?size=````
- max:
size: { x: 1400, y: 819}
name: 'max'
- mid :
size: {x: 700, y: 410}
name: 'mid'
- small:
size: {x: 400,y: 234}
name: 'small'
- user:
size: {x: 150,y: 150}
name: 'user'
- userThumb:
size: {x: 50,y: 50},
name: 'userThumb'