v1.18.x
Baris Soner Usakli 11 years ago
parent bcb492751c
commit de34c7580f

@ -9,7 +9,9 @@
<label>Site Description</label>
<input type="text" class="form-control" placeholder="A short description about your community" data-field="description" /><br />
<label>Imgur Client ID</label>
<input type="text" class="form-control" placeholder="Imgur ClientID for image uploads" data-field="imgurClientID" />
<input type="text" class="form-control" placeholder="Imgur ClientID for image uploads" data-field="imgurClientID" /><br />
<label>Maximum User Image Size</label>
<input type="text" class="form-control" placeholder="Maximum size of uploaded user images in kilobytes" data-field="maximumProfileImageSize" />
</form>
</div>

@ -113,6 +113,9 @@ var async = require('async'),
}, {
field: 'imgurClientID',
value: ''
}, {
field: 'maximumProfileImageSize',
value: 256
}];
async.each(defaults, function (configObj, next) {

@ -5,7 +5,8 @@ var user = require('./../user.js'),
utils = require('./../../public/src/utils.js'),
path = require('path'),
winston = require('winston'),
nconf = require('nconf');
nconf = require('nconf'),
meta = require('./../meta');
(function(User) {
User.create_routes = function(app) {
@ -136,9 +137,11 @@ var user = require('./../user.js'),
if (!req.user)
return res.redirect('/403');
if (req.files.userPhoto.size > 262144) {
var uploadSize = meta.config.maximumProfileImageSize || 256;
if (req.files.userPhoto.size > uploadSize * 1024) {
res.send({
error: 'Images must be smaller than 256kb!'
error: 'Images must be smaller than ' + uploadSize + ' kb!'
});
return;
}

Loading…
Cancel
Save