-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
I'm getting the following output:
2019-08-19T17:19:24.531 [Information] Executing 'Functions.PdfToTiffConverter' (Reason='EventGrid trigger fired at 2019-08-19T17:19:24.4859961+00:00', Id=161802cf-f5b9-4555-8e36-a9ca7e0daf91)
2019-08-19T17:20:26.112 [Information] Error: w and h must be numbers
at Jimp.throwError (D:\home\site\wwwroot\node_modules@jimp\utils\dist\index.js:26:13)
at Jimp.resize (D:\home\site\wwwroot\node_modules@jimp\plugin-resize\dist\index.js:38:36)
at Jimp.read.then (D:\home\site\wwwroot\PdfToTiffConverter\index.js:14:19)
I'm using this code:
const stream = require('stream');
const Jimp = require('jimp');
const storage = require('azure-storage');
const blobService = storage.createBlobService();
module.exports = (context, myEvent, myBlob) => {
const widthInPixels = process.env.THUMBNAIL_WIDTH;
const blobName = myEvent.subject.split('/')[6];
Jimp.read(myBlob).then((thumbnail) => {
thumbnail.resize(widthInPixels, Jimp.AUTO);
thumbnail.getBuffer(Jimp.MIME_PNG, (err, buffer) => {
const readStream = stream.PassThrough();
readStream.end(buffer);
blobService.createBlockBlobFromStream('thumbnails', blobName, readStream, buffer.length, (err) => {
context.done();
});
});
}).catch(context.log);
};
Metadata
Metadata
Assignees
Labels
No labels