Replace image resizing sample with chartist sample

This commit is contained in:
Steve Sanderson
2017-02-22 13:27:18 +00:00
parent 3162946139
commit 627ea78e72
11 changed files with 42 additions and 113 deletions

View File

@@ -0,0 +1,8 @@
var generate = require('node-chartist');
module.exports = function (callback, type, options, data) {
generate(type, options, data).then(
result => callback(null, result), // Success case
error => callback(error) // Error case
);
};

View File

@@ -1,8 +0,0 @@
var sharp = require('sharp');
module.exports = function(result, physicalPath, mimeType, maxWidth, maxHeight) {
// Invoke the 'sharp' NPM module, and have it pipe the resulting image data back to .NET
sharp(physicalPath)
.resize(maxWidth || null, maxHeight || null)
.pipe(result.stream);
}