feat: dynamically load heic2any to accelerate initial page loading speed
This commit is contained in:
@@ -1528,3 +1528,15 @@ export const getAge = (birthDate) => {
|
||||
}
|
||||
return age.toString();
|
||||
};
|
||||
|
||||
export const convertHeicToJpeg = async (file: File) => {
|
||||
const { default: heic2any } = await import('heic2any');
|
||||
try {
|
||||
return await heic2any({ blob: file, toType: 'image/jpeg' });
|
||||
} catch (err: any) {
|
||||
if (err?.message?.includes('already browser readable')) {
|
||||
return file;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user