Editor node.js - Get height and with of img file

Editor node.js - Get height and with of img file

CapamaniaCapamania Posts: 233Questions: 81Answers: 5
edited November 2020 in Editor

Is there a way to get height and width of a uploaded img file? I want to validate height x width geometric.

.validator(
    Validate.fileExtensions(
         ['png', 'jpg'],
         'Only image files can be uploaded (png and jpg)'
    )
 )
 .validator( file => {
      console.log('file:');
      console.log(file);

      return true;
   })

console:

{ uuid: 'fsdfe20sdfsdf1',
  field: 'upload',
  file: '/tmp/express-busboy/fsdfe20sdfsdf1/upload/logo.jpg',
  filename: 'logo.jpg',
  encoding: '7bit',
  mimetype: 'image/jpeg',
  truncated: 'false',
  done: 'true',
  size: 16453,
  extn: 'jpg',
  name: 'logo' }

Answers

This discussion has been closed.