mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-07 18:01:51 +02:00
closes #6373
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
"private": "Make uploaded files private",
|
||||
"max-image-width": "Resize images down to specified width (in pixels)",
|
||||
"max-image-width-help": "(in pixels, default: 760 pixels, set to 0 to disable)",
|
||||
"resize-image-quality": "Quality to use when resizing images",
|
||||
"resize-image-quality-help": "Use a lower quality setting to reduce the file size of resized images.",
|
||||
"max-file-size": "Maximum File Size (in KiB)",
|
||||
"max-file-size-help": "(in kibibytes, default: 2048 KiB)",
|
||||
"allow-topic-thumbnails": "Allow users to upload topic thumbnails",
|
||||
|
||||
@@ -118,6 +118,7 @@ function resizeImage(fileObj, callback) {
|
||||
target: path.join(dirname, basename + '-resized' + extname),
|
||||
extension: extname,
|
||||
width: parseInt(meta.config.maximumImageWidth, 10) || 760,
|
||||
quality: parseInt(meta.config.resizeImageQuality, 10) || 60,
|
||||
}, next);
|
||||
},
|
||||
function (next) {
|
||||
|
||||
@@ -20,6 +20,7 @@ image.resizeImage = function (data, callback) {
|
||||
extension: data.extension,
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
quality: data.quality,
|
||||
}, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
@@ -73,6 +74,12 @@ image.resizeImage = function (data, callback) {
|
||||
next(null, image);
|
||||
}
|
||||
},
|
||||
function (image, next) {
|
||||
if (data.quality) {
|
||||
image.quality(data.quality);
|
||||
}
|
||||
next(null, image);
|
||||
},
|
||||
function (image, next) {
|
||||
image.write(data.target || data.path, next);
|
||||
},
|
||||
|
||||
@@ -28,6 +28,14 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="resizeImageQuality">[[admin/settings/uploads:resize-image-quality]]</label>
|
||||
<input type="text" class="form-control" value="60" data-field="resizeImageQuality" placeholder="60">
|
||||
<p class="help-block">
|
||||
[[admin/settings/uploads:resize-image-quality-help]]
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="maximumFileSize">[[admin/settings/uploads:max-file-size]]</label>
|
||||
<input type="text" class="form-control" value="2048" data-field="maximumFileSize">
|
||||
|
||||
Reference in New Issue
Block a user