Random changes

This commit is contained in:
X4Lo committed 2024-10-21 16:06:32 +01:00
1 parent 7160669468
commit 0b1a1d989f
17 files changed
+205 -159

No files matched your search

+11 -5
View File
@@ -145,7 +145,7 @@ function doGeneratePreview(fileCategory, fileType, originalFileName, previewWidt
const originalPath = path.join(mediaPath, originalFileName);
const fileNameWithoutExt = originalFileName.split('.')[0];
const previewFileName = fileNameWithoutExt + '_preview.jpg'
const previewFileName = fileNameWithoutExt + '_preview.jpg';
const previewPath = path.join(mediaPath, previewFileName);
if (previewWidth == 0) {
@@ -154,10 +154,16 @@ function doGeneratePreview(fileCategory, fileType, originalFileName, previewWidt
if (fileType == 'logos') previewWidth = 300;
}
return sharp(originalPath)
.resize({ width: previewWidth })
.jpeg({ quality: previewQuality })
.toFile(previewPath);
if (fileType == 'logos') {
return sharp(originalPath)
.resize({ width: previewWidth })
.toFile(previewPath.replace('.jpg', '.png'));
} else {
return sharp(originalPath)
.resize({ width: previewWidth })
.jpeg({ quality: previewQuality })
.toFile(previewPath);
}
}
function getMediaFolder() {