mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-09 11:36:38 +08:00
fix: upload .heic image
This commit is contained in:
parent
5136c14a4d
commit
9ebdb3239a
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user