Remove autoOrientJPEG and consolidate downscaling logic
This commit is contained in:
parent
3eed6cb350
commit
09b5e6ef50
10 changed files with 105 additions and 144 deletions
|
@ -46,6 +46,8 @@ export async function handleImageAttachment(
|
|||
: stringToMIMEType(file.type),
|
||||
fileName: file.name,
|
||||
file: processedFile,
|
||||
// We always store draft attachments as HQ
|
||||
highQuality: true,
|
||||
});
|
||||
|
||||
const data = await blobToArrayBuffer(resizedBlob);
|
||||
|
@ -66,10 +68,12 @@ export async function autoScale({
|
|||
contentType,
|
||||
file,
|
||||
fileName,
|
||||
highQuality,
|
||||
}: {
|
||||
contentType: MIMEType;
|
||||
file: File | Blob;
|
||||
fileName: string;
|
||||
highQuality: boolean;
|
||||
}): Promise<{
|
||||
contentType: MIMEType;
|
||||
file: Blob;
|
||||
|
@ -79,12 +83,12 @@ export async function autoScale({
|
|||
return { contentType, file, fileName };
|
||||
}
|
||||
|
||||
const { blob, contentType: newContentType } = await scaleImageToLevel(
|
||||
file,
|
||||
const { blob, contentType: newContentType } = await scaleImageToLevel({
|
||||
fileOrBlobOrURL: file,
|
||||
contentType,
|
||||
file.size,
|
||||
true
|
||||
);
|
||||
size: file.size,
|
||||
highQuality,
|
||||
});
|
||||
|
||||
if (newContentType !== IMAGE_JPEG) {
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue