mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
took out the meta config check from image.js
This commit is contained in:
@@ -404,7 +404,11 @@ accountsController.uploadPicture = function (req, res, next) {
|
|||||||
image.resizeImage(req.files.userPhoto.path, extension, 128, 128, next);
|
image.resizeImage(req.files.userPhoto.path, extension, 128, 128, next);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
if (parseInt(meta.config['profile:convertProfileImageToPNG'], 10) === 1) {
|
||||||
image.convertImageToPng(req.files.userPhoto.path, extension, next);
|
image.convertImageToPng(req.files.userPhoto.path, extension, next);
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
user.getUidByUserslug(req.params.userslug, next);
|
user.getUidByUserslug(req.params.userslug, next);
|
||||||
@@ -450,7 +454,7 @@ accountsController.uploadPicture = function (req, res, next) {
|
|||||||
return plugins.fireHook('filter:uploadImage', req.files.userPhoto, done);
|
return plugins.fireHook('filter:uploadImage', req.files.userPhoto, done);
|
||||||
}
|
}
|
||||||
|
|
||||||
var convertToPNG = parseInt(meta.config['profile:convertProfileImageToPNG'], 10);
|
var convertToPNG = parseInt(meta.config['profile:convertProfileImageToPNG'], 10) === 1;
|
||||||
var filename = updateUid + '-profileimg' + (convertToPNG ? '.png' : extension);
|
var filename = updateUid + '-profileimg' + (convertToPNG ? '.png' : extension);
|
||||||
|
|
||||||
user.getUserField(updateUid, 'uploadedpicture', function (err, oldpicture) {
|
user.getUserField(updateUid, 'uploadedpicture', function (err, oldpicture) {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
gm = require('gm').subClass({imageMagick: true}),
|
gm = require('gm').subClass({imageMagick: true});
|
||||||
meta = require('./meta');
|
|
||||||
|
|
||||||
var image = {};
|
var image = {};
|
||||||
|
|
||||||
@@ -28,8 +27,7 @@ image.resizeImage = function(path, extension, width, height, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
image.convertImageToPng = function(path, extension, callback) {
|
image.convertImageToPng = function(path, extension, callback) {
|
||||||
var convertToPNG = parseInt(meta.config['profile:convertProfileImageToPNG'], 10);
|
if(extension !== '.png') {
|
||||||
if(convertToPNG && extension !== '.png') {
|
|
||||||
gm(path).toBuffer('png', function(err, buffer) {
|
gm(path).toBuffer('png', function(err, buffer) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user