mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Merge pull request #169 from PascalTemel/master
Replace graphicsmagick with sharp
This commit is contained in:
commit
ea575898f3
@ -79,8 +79,7 @@ module.exports = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE: Thumbnails are only for the admin panel and they require you
|
NOTE: Thumbnails are only for the admin panel and they require you
|
||||||
to install a separate binary called graphicsmagick (http://www.graphicsmagick.org)
|
to install a separate binary called ffmpeg (https://ffmpeg.org/) for video files
|
||||||
for images and ffmpeg (https://ffmpeg.org/) for video files
|
|
||||||
*/
|
*/
|
||||||
generateThumbnails: false,
|
generateThumbnails: false,
|
||||||
|
|
||||||
|
@ -47,17 +47,25 @@ utilsController.generateThumbs = function(file, basedomain) {
|
|||||||
})
|
})
|
||||||
.on('error', error => console.log('Error - ', error.message));
|
.on('error', error => console.log('Error - ', error.message));
|
||||||
} else {
|
} else {
|
||||||
let size = {
|
let resizeOptions = {
|
||||||
width: 200,
|
width: 200,
|
||||||
height: 200
|
height: 200,
|
||||||
|
fit: 'contain',
|
||||||
|
background: {
|
||||||
|
r: 0,
|
||||||
|
g: 0,
|
||||||
|
b: 0,
|
||||||
|
alpha: 0
|
||||||
|
}
|
||||||
};
|
};
|
||||||
gm(path.join(__dirname, '..', config.uploads.folder, file.name))
|
|
||||||
.resize(size.width, size.height + '>')
|
sharp(path.join(__dirname, '..', config.uploads.folder, file.name))
|
||||||
.gravity('Center')
|
.resize(resizeOptions)
|
||||||
.extent(size.width, size.height)
|
.toFile(thumbname)
|
||||||
.background('transparent')
|
.catch((error) => {
|
||||||
.write(thumbname, error => {
|
if (error) {
|
||||||
if (error) console.log('Error - ', error);
|
console.log('Error - ', error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
"express-handlebars": "^3.0.0",
|
"express-handlebars": "^3.0.0",
|
||||||
"express-rate-limit": "^2.11.0",
|
"express-rate-limit": "^2.11.0",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
"gm": "^1.23.1",
|
|
||||||
"helmet": "^3.11.0",
|
"helmet": "^3.11.0",
|
||||||
"jszip": "^3.1.5",
|
"jszip": "^3.1.5",
|
||||||
"knex": "^0.14.4",
|
"knex": "^0.14.4",
|
||||||
"multer": "^1.3.0",
|
"multer": "^1.3.0",
|
||||||
"randomstring": "^1.1.5",
|
"randomstring": "^1.1.5",
|
||||||
|
"sharp": "^0.21.0",
|
||||||
"sqlite3": "^3.1.13"
|
"sqlite3": "^3.1.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
Loading…
Reference in New Issue
Block a user