mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Fixing tests #558
This commit is contained in:
parent
c181bd5fb5
commit
e9aefb822e
@ -100,6 +100,7 @@ export class PhotoProcessing {
|
|||||||
},
|
},
|
||||||
useLanczos3: Config.Media.Thumbnail.useLanczos3,
|
useLanczos3: Config.Media.Thumbnail.useLanczos3,
|
||||||
quality: Config.Media.Thumbnail.quality,
|
quality: Config.Media.Thumbnail.quality,
|
||||||
|
smartSubsample: Config.Media.Thumbnail.smartSubsample,
|
||||||
} as RendererInput;
|
} as RendererInput;
|
||||||
input.cut.width = Math.min(
|
input.cut.width = Math.min(
|
||||||
input.cut.width,
|
input.cut.width,
|
||||||
@ -149,6 +150,10 @@ export class PhotoProcessing {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells if the path is valid with the current config
|
||||||
|
* @param convertedPath
|
||||||
|
*/
|
||||||
public static async isValidConvertedPath(
|
public static async isValidConvertedPath(
|
||||||
convertedPath: string
|
convertedPath: string
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
@ -179,16 +184,24 @@ export class PhotoProcessing {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qualityStr = convertedPath.substring(
|
|
||||||
|
let qualityStr = convertedPath.substring(
|
||||||
convertedPath.lastIndexOf('q') + 1,
|
convertedPath.lastIndexOf('q') + 1,
|
||||||
convertedPath.length - path.extname(convertedPath).length
|
convertedPath.length - path.extname(convertedPath).length
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if (Config.Media.Thumbnail.smartSubsample) {
|
||||||
|
if (!qualityStr.endsWith('cs')) { // remove chromatic subsampling flag if exists
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
qualityStr = qualityStr.slice(0, -2);
|
||||||
|
}
|
||||||
|
|
||||||
const quality = parseInt(qualityStr, 10);
|
const quality = parseInt(qualityStr, 10);
|
||||||
|
|
||||||
if ((quality + '').length !== qualityStr.length ||
|
if ((quality + '').length !== qualityStr.length ||
|
||||||
quality < 0 ||
|
quality !== Config.Media.Thumbnail.quality) {
|
||||||
quality > 100) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user