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