1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-17 11:18:36 +01:00

Fix name logic

This commit is contained in:
Nayam Amarshe 2024-04-21 23:09:13 +05:30
parent d095ded3ff
commit 938bc0d83a
3 changed files with 12 additions and 23 deletions

View File

@ -46,7 +46,9 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
const useCustomWidth = payload.useCustomWidth;
const customWidth = useCustomWidth ? payload.customWidth : "";
const outputFolderName = `upscayl_${saveImageAs}_${model}_${scale ? scale : ""}${useCustomWidth ? "px" : "x"}`;
const outputFolderName = `upscayl_${saveImageAs}_${model}_${
useCustomWidth ? `${customWidth}px` : `${scale}x`
}`;
outputFolderPath += slash + outputFolderName;
if (!fs.existsSync(outputFolderPath)) {

View File

@ -55,15 +55,9 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => {
const customWidth = useCustomWidth ? payload.customWidth : "";
const outFile =
outputDir +
slash +
fileName +
"_upscayl_" +
(scale ? scale : "") +
(useCustomWidth ? "px_" : "x_") +
model +
"." +
saveImageAs;
outputDir + slash + fileName + "_upscayl_" + useCustomWidth
? `${customWidth}px_`
: `${scale}x_` + model + "." + saveImageAs;
// UPSCALE
let upscayl = spawnUpscayl(

View File

@ -61,18 +61,12 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
const useCustomWidth = payload.useCustomWidth;
const customWidth = useCustomWidth ? payload.customWidth : "";
const desiredScale = payload.scale;
const scale = payload.scale;
const outFile =
outputDir +
slash +
fileName +
"_upscayl_" +
desiredScale +
(useCustomWidth ? "px_" : "x_") +
model +
"." +
saveImageAs;
outputDir + slash + fileName + "_upscayl_" + useCustomWidth
? `${customWidth}px_`
: `${scale}x_` + model + "." + saveImageAs;
// UPSCALE
if (fs.existsSync(outFile) && !overwrite) {
@ -96,8 +90,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
outputDir,
fullfileName,
fileName,
scale: desiredScale,
desiredScale,
scale,
outFile,
compression: savedCompression,
}),
@ -111,7 +104,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => {
? modelsPath
: savedCustomModelsPath ?? modelsPath,
model,
scale: desiredScale,
scale,
gpuId,
saveImageAs,
customWidth,