2018-07-27 21:31:08 +02:00
|
|
|
const sizeOf = require('image-size');
|
2018-07-27 18:58:00 +02:00
|
|
|
|
|
|
|
const getImageHeightAndWidth = (filePath) => {
|
2018-07-27 19:43:43 +02:00
|
|
|
return new Promise((resolve, reject) => {
|
2018-07-27 21:31:08 +02:00
|
|
|
try {
|
|
|
|
const { height, width } = sizeOf(filePath);
|
2018-07-27 19:43:43 +02:00
|
|
|
resolve([height, width]);
|
2018-07-27 21:31:08 +02:00
|
|
|
} catch (error) {
|
|
|
|
reject(error);
|
|
|
|
}
|
2018-07-27 18:58:00 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getImageHeightAndWidth,
|
|
|
|
};
|