mirror of
https://github.com/zadam/trilium.git
synced 2025-01-15 19:51:57 +08:00
add default JPG quality if value not in range
This commit is contained in:
parent
074eb1c02f
commit
a098630e09
2 changed files with 7 additions and 3 deletions
|
@ -34,8 +34,8 @@ const TPL = `
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="image-jpeg-quality">JPEG quality (0 - worst quality, 100 best quality, 50 - 85 is recommended)</label>
|
||||
<input class="form-control" id="image-jpeg-quality" min="0" max="100" type="number">
|
||||
<label for="image-jpeg-quality">JPEG quality (10 - worst quality, 100 best quality, 50 - 85 is recommended)</label>
|
||||
<input class="form-control" id="image-jpeg-quality" min="10" max="100" type="number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -122,7 +122,11 @@ function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSwitch,
|
|||
}
|
||||
|
||||
async function shrinkImage(buffer, originalName) {
|
||||
const jpegQuality = optionService.getOptionInt('imageJpegQuality');
|
||||
let jpegQuality = optionService.getOptionInt('imageJpegQuality');
|
||||
|
||||
if (jpegQuality < 10 || jpegQuality > 100) {
|
||||
jpegQuality = 75;
|
||||
}
|
||||
|
||||
let finalImageBuffer;
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue