Do not transcode images if they meet the size thresholds
This commit is contained in:
parent
9066067aa4
commit
81c57107ce
6 changed files with 89 additions and 10 deletions
|
@ -73,7 +73,19 @@ export async function autoScale({
|
|||
return { contentType, file, fileName };
|
||||
}
|
||||
|
||||
const blob = await scaleImageToLevel(file, true);
|
||||
const { blob, contentType: newContentType } = await scaleImageToLevel(
|
||||
file,
|
||||
contentType,
|
||||
true
|
||||
);
|
||||
|
||||
if (newContentType !== IMAGE_JPEG) {
|
||||
return {
|
||||
contentType,
|
||||
file: blob,
|
||||
fileName,
|
||||
};
|
||||
}
|
||||
|
||||
const { name } = path.parse(fileName);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue