mirror of
https://github.com/samsonjs/immich.git
synced 2026-03-25 09:15:56 +00:00
feat: jxl browser support detection (#25599)
This commit is contained in:
parent
adfb003d03
commit
1ddb8f0667
1 changed files with 10 additions and 1 deletions
|
|
@ -303,9 +303,18 @@ const supportedImageMimeTypes = new Set([
|
||||||
|
|
||||||
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755
|
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755
|
||||||
if (isSafari) {
|
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
|
* Returns true if the asset is an image supported by web browsers, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue