feat: webp convert @frontend (#11150)
* webp convert @frontend * 0.85 → 0.90 --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
parent
d5c4e77c44
commit
bc4d27410c
2 changed files with 19 additions and 1 deletions
10
packages/frontend/src/scripts/upload/isWebpSupported.ts
Normal file
10
packages/frontend/src/scripts/upload/isWebpSupported.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
let isWebpSupportedCache: boolean | undefined;
|
||||
export function isWebpSupported() {
|
||||
if (isWebpSupportedCache === undefined) {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 1;
|
||||
canvas.height = 1;
|
||||
isWebpSupportedCache = canvas.toDataURL('image/webp').startsWith('data:image/webp');
|
||||
}
|
||||
return isWebpSupportedCache;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue