Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uni.getImageInfo不能正确获取图片方向 #4708

Open
SilentGene opened this issue Jan 28, 2024 · 0 comments
Open

uni.getImageInfo不能正确获取图片方向 #4708

SilentGene opened this issue Jan 28, 2024 · 0 comments

Comments

@SilentGene
Copy link

问题描述
用uni.getImageInfo在安卓平台测试获取图片的orientation,无论是横向还是竖向的图,都返回up, 但实际上用手机图片详情或者图虫exif查看,都可以看到横图被标注为180,竖图被标为90.

复现步骤
示例图片:
2024-01-28-19-05-13-751

图虫exif信息:
Snipaste_2024-01-28_20-57-35

而用uniapp获取到的信息:
image

贴上代码:

methods: {
    selectImage() {
      uni.chooseImage({
        count: 1,
        sizeType: ['original'],
        sourceType: ['album'],
        success: (res) => {
          this.imageSrc = res.tempFilePaths[0];
          // 获取图片信息以便后续处理
          uni.getImageInfo({
            src: this.imageSrc,
            success: (info) => {
			  console.log('图片信息:', info)
...

预期结果
正确获取图片方向:90

实际结果

{
    "path": "file:///storage/emulated/0/DCIM/Camera/2024-01-28-19-05-13-751.jpg",
    "width": 4022,
    "height": 3016,
    "orientation": "up",
    "type": "jpeg",
    "errMsg": "getImageInfo:ok"
}

系统信息:

  • 发行平台: 安卓
  • 操作系统 Android 11
  • HBuilderX版本 3.99
  • uni-app版本 不太清楚,是用的vue3编写
  • 设备信息 小米6+LineageOS 20

补充信息
另外附上一张横向的图片,图虫exif正确识别方向为180,而uniapp一样返回up
2024-01-28-20-14-51-554
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant