Add thumbnails quality config
This commit is contained in:
parent
bfdd071001
commit
2c84c93f3d
|
@ -9,7 +9,7 @@ const enableExtensions = true; //Enables support for TavernAI-extras project
|
||||||
const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine.
|
const listen = true; // If true, Can be access from other device or PC. otherwise can be access only from hosting machine.
|
||||||
const allowKeysExposure = false; // If true, private API keys could be fetched to the frontend.
|
const allowKeysExposure = false; // If true, private API keys could be fetched to the frontend.
|
||||||
const skipContentCheck = false; // If true, no new default content will be delivered to you.
|
const skipContentCheck = false; // If true, no new default content will be delivered to you.
|
||||||
|
const thumbnailsQuality = 95; // Quality of thumbnails. 0-100
|
||||||
|
|
||||||
// If true, Allows insecure settings for listen, whitelist, and authentication.
|
// If true, Allows insecure settings for listen, whitelist, and authentication.
|
||||||
// Change this setting only on "trusted networks". Do not change this value unless you are aware of the issues that can arise from changing this setting and configuring a insecure setting.
|
// Change this setting only on "trusted networks". Do not change this value unless you are aware of the issues that can arise from changing this setting and configuring a insecure setting.
|
||||||
|
@ -47,5 +47,6 @@ module.exports = {
|
||||||
securityOverride,
|
securityOverride,
|
||||||
skipContentCheck,
|
skipContentCheck,
|
||||||
requestOverrides,
|
requestOverrides,
|
||||||
|
thumbnailsQuality,
|
||||||
extras,
|
extras,
|
||||||
};
|
};
|
||||||
|
|
|
@ -107,8 +107,9 @@ async function generateThumbnail(type, file) {
|
||||||
let buffer;
|
let buffer;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const quality = getConfigValue('thumbnailsQuality', 95);
|
||||||
const image = await jimp.read(pathToOriginalFile);
|
const image = await jimp.read(pathToOriginalFile);
|
||||||
buffer = await image.cover(mySize[0], mySize[1]).quality(95).getBufferAsync('image/jpeg');
|
buffer = await image.cover(mySize[0], mySize[1]).quality(quality).getBufferAsync('image/jpeg');
|
||||||
}
|
}
|
||||||
catch (inner) {
|
catch (inner) {
|
||||||
console.warn(`Thumbnailer can not process the image: ${pathToOriginalFile}. Using original size`);
|
console.warn(`Thumbnailer can not process the image: ${pathToOriginalFile}. Using original size`);
|
||||||
|
|
Loading…
Reference in New Issue