google / google/model-viewer

Support Blob and File as value types for backgroundImage and environmentImage

Open
#400 4 comments 0 reactions 0 assignees View on GitHub
arc: community arc: compatibility type: feature
Dominant language
TypeScript
Stars
8.2k
Forks
947
PR merge metrics
No merged PRs in 30d

Description

Currently, we detect HDR images by their file extension. This is great if you only ever use URLs to specify the image, but it falls apart for drag/drop (such as with Ricardo's demo [here](https://truthful-roof.glitch.me/)) and other workflows where the file extension is obscured by [`URL.createObjectURL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL).

There are a few ways to address this that might be worth discussing. However, I would recommend that for the user's benefit we should transparently support `Blob` and `File` as valid values for `backgroundImage` and `environmentImage`. Both of these values should give us enough information to detect an HDR image (mime-type and filename, respectively). This will allow users to directly assign these properties and not worry about the finer details required to accomplish what they are trying to do.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.