Skip to content

[Information] Error: w and h must be numbers #2

@alexgman

Description

@alexgman

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions