Add support for EXR and HDR image formats
This commit is contained in:
@@ -51,8 +51,12 @@ function inferImageMimeType(sourceName: string, fallbackMimeType: string): strin
|
||||
switch (getFileExtension(sourceName)) {
|
||||
case "avif":
|
||||
return "image/avif";
|
||||
case "exr":
|
||||
return "image/x-exr";
|
||||
case "gif":
|
||||
return "image/gif";
|
||||
case "hdr":
|
||||
return "image/vnd.radiance";
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
return "image/jpeg";
|
||||
@@ -63,10 +67,15 @@ function inferImageMimeType(sourceName: string, fallbackMimeType: string): strin
|
||||
case "webp":
|
||||
return "image/webp";
|
||||
default:
|
||||
throw new Error(`Unsupported image asset format for ${sourceName}. Use a browser-supported image file.`);
|
||||
throw new Error(`Unsupported image asset format for ${sourceName}. Use a browser-supported image file or .exr/.hdr.`);
|
||||
}
|
||||
}
|
||||
|
||||
function isHdrFormat(sourceName: string): boolean {
|
||||
const ext = getFileExtension(sourceName);
|
||||
return ext === "exr" || ext === "hdr";
|
||||
}
|
||||
|
||||
function getImportedFilePath(file: File): string {
|
||||
const relativePath = typeof file.webkitRelativePath === "string" ? file.webkitRelativePath.trim() : "";
|
||||
const sourcePath = relativePath.length > 0 ? relativePath : file.name.trim();
|
||||
|
||||
Reference in New Issue
Block a user