Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript exif js orientation在android上始终返回0,但在桌面上工作_Javascript_Android_Exif - Fatal编程技术网

Javascript exif js orientation在android上始终返回0,但在桌面上工作

Javascript exif js orientation在android上始终返回0,但在桌面上工作,javascript,android,exif,Javascript,Android,Exif,我正在使用exif js库从上传到web应用程序的图像中提取方向。 我需要exif方向来旋转旋转不正确的android图像 问题是,从android设备上传的图像总是返回0作为方向 我试着把从同一个安卓设备上拍摄的图像传输到桌面,然后从那里上传,在这种情况下一切都很好,我得到了方向6 localforage.getItem('photo').then(function(value) { alert('inside forage'); ima

我正在使用exif js库从上传到web应用程序的图像中提取方向。 我需要exif方向来旋转旋转不正确的android图像

问题是,从android设备上传的图像总是返回0作为方向

我试着把从同一个安卓设备上拍摄的图像传输到桌面,然后从那里上传,在这种情况下一切都很好,我得到了方向6

localforage.getItem('photo').then(function(value) {
                alert('inside forage');
            image = value;
            alert(image); // i get the image object
            url = window.URL.createObjectURL(image);
            alert(url); // url is correct
                let preview = document.getElementById('camera-feed');
                preview.src = url;
                // const tags = ExifReader.load(image);
                console.log( tags );
            EXIF.getData(image, function() {
               myData = this;
                 if (myData.exifdata.Orientation) {
                        orientation = parseInt(EXIF.getTag(this, "Orientation"));
                        alert(orientation); // on desktop 6, on android always 0
                 }
            });
            ....

我正在android上使用chrome浏览器。

在我的项目中做了很多更改之后,我使用了
用于处理前端图像旋转的库

我知道您已经解决了这个问题,但如果您需要的不仅仅是方向,我仍然希望推荐库。或者如果性能对您很重要。Exifr速度很快,可以处理数百张照片,而不会使浏览器崩溃或花费很长时间:)。此外,还有一个简洁的API,您可以为它提供几乎任何东西—元素、URL、缓冲区、ArrayBuffer,甚至base64 URL或字符串等等

exifr.orientation(文件)。然后(val=>{
console.log('orientation:',val)
})