This commit is contained in:
shansing 2024-07-19 15:44:31 +08:00 committed by GitHub
commit 43f55017b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,10 @@ export function compressImage(file: File, maxSize: number): Promise<string> {
};
reader.onerror = reject;
if (file.type.includes("heic")) {
if (
file.name.toLowerCase().endsWith(".heic") ||
file.type.includes("heic")
) {
heic2any({ blob: file, toType: "image/jpeg" })
.then((blob) => {
reader.readAsDataURL(blob as Blob);
@ -47,8 +50,8 @@ export function compressImage(file: File, maxSize: number): Promise<string> {
.catch((e) => {
reject(e);
});
}
} else {
reader.readAsDataURL(file);
}
});
}