mirror of
https://github.com/immich-app/immich.git
synced 2026-02-13 15:04:29 -05:00
feat: jxl browser support detection (#25599)
This commit is contained in:
parent
adfb003d03
commit
1ddb8f0667
@ -303,9 +303,18 @@ const supportedImageMimeTypes = new Set([
|
||||
|
||||
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755
|
||||
if (isSafari) {
|
||||
supportedImageMimeTypes.add('image/heic').add('image/heif').add('image/jxl');
|
||||
supportedImageMimeTypes.add('image/heic').add('image/heif');
|
||||
}
|
||||
|
||||
function checkJxlSupport(): void {
|
||||
const img = new Image();
|
||||
img.addEventListener('load', () => {
|
||||
supportedImageMimeTypes.add('image/jxl');
|
||||
});
|
||||
img.src = 'data:image/jxl;base64,/woIAAAMABKIAgC4AF3lEgA='; // Small valid JPEG XL image
|
||||
}
|
||||
checkJxlSupport();
|
||||
|
||||
/**
|
||||
* Returns true if the asset is an image supported by web browsers, false otherwise
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user