fix: Images on iOS are cropped weird (#1840)
* force sync decoding on images * use decode() to load the image * add comment
This commit is contained in:
parent
965e482ea3
commit
bd84b8bf88
@ -133,8 +133,12 @@ export const useMediaHelper = ({ src, srcSet: srcSetIntital, topLevel, tab }) =>
|
||||
// hack
|
||||
// if it's not a video it will throw an error, so we can assume it's an image
|
||||
const img = new window.Image()
|
||||
img.onload = () => setIsImage(true)
|
||||
img.src = src
|
||||
img.decode().then(() => { // decoding beforehand to prevent wrong image cropping
|
||||
setIsImage(true)
|
||||
}).catch((e) => {
|
||||
console.error('Cannot decode image', e)
|
||||
})
|
||||
}
|
||||
video.src = src
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user