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