Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion web/src/lib/utils/asset-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Loading