mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: allow gif profile images, sharp 0.30.0 supports gifs
This commit is contained in:
@@ -46,6 +46,7 @@ image.resizeImage = async function (data) {
|
||||
const buffer = await fs.promises.readFile(data.path);
|
||||
const sharpImage = sharp(buffer, {
|
||||
failOnError: true,
|
||||
animated: data.path.endsWith('gif'),
|
||||
});
|
||||
const metadata = await sharpImage.metadata();
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ const db = require('../database');
|
||||
const file = require('../file');
|
||||
const image = require('../image');
|
||||
const meta = require('../meta');
|
||||
const plugins = require('../plugins');
|
||||
|
||||
module.exports = function (User) {
|
||||
User.getAllowedProfileImageExtensions = function () {
|
||||
@@ -21,11 +20,7 @@ module.exports = function (User) {
|
||||
};
|
||||
|
||||
User.getAllowedImageTypes = function () {
|
||||
const allowedTypes = ['image/png', 'image/jpeg', 'image/bmp'];
|
||||
if (plugins.hooks.hasListeners('filter:image.isFileTypeAllowed')) {
|
||||
allowedTypes.push('image/gif');
|
||||
}
|
||||
return allowedTypes;
|
||||
return ['image/png', 'image/jpeg', 'image/bmp', 'image/gif'];
|
||||
};
|
||||
|
||||
User.updateCoverPosition = async function (uid, position) {
|
||||
|
||||
Reference in New Issue
Block a user