mirror of
https://github.com/luxfi/pics.git
synced 2026-10-30 15:22:15 +00:00
18 lines
466 B
JavaScript
18 lines
466 B
JavaScript
const gm = require('@fatchan/gm')
|
|
, uploadDirectory = require(__dirname+'/../uploaddirectory.js');
|
|
|
|
module.exports = (filename, folder, temp) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
const filePath = temp === true ? filename : `${uploadDirectory}/${folder}/${filename}`;
|
|
gm(`${filePath}[0]`) //0 for first frame of gifs, much faster
|
|
.size(function (err, data) {
|
|
if (err) {
|
|
return reject(err);
|
|
}
|
|
return resolve(data);
|
|
});
|
|
});
|
|
|
|
};
|