So I seem to found out a weird behaviour when detecting image type (landscape / portrait) on IPhone XR image (heic format). It seems that javascript have the the image width and height switched. Is there any information about this behaviour? Or do you guys have any suggestion about what happen? The code detecting normal behaviour in any other image.
reader.onload = function (e) {
const img = new Image()
img.src = e.target.result
img.onload = (f) => {
// nuxt,vue
that.$nextTick(() => {
const width = img.width
const height = img.height
console.log(img.width, img.naturalWidth, img.height, img.naturalHeight)
if (height > width) {
that.imgType = 'portrait'
} else {
that.imgType = 'landscape'
}
console.log(that.imgType)
})
}
that.img = img
}
reader.readAsDataURL(this.$refs.fileUpload.files[0])