html52.com
我爱小程序-开发者交流社区

微信小程序中前置摄像头拍照是否会保持左右镜像?

问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 小程序 Bug camera 客户端 6.7.4 2.3.2

- 当前 Bug 的表现(可附上截图)

在用<camera>前置摄像头拍照,iphone上得到的照片与iphone原生相机拍照左右镜像相反。请问微信小程序上,前置摄像头拍照是否都会保持左右颠倒?


- 预期表现


- 复现路径


- 提供一个最简复现 Demo


网友回复

熊市不努力,牛市徒伤悲:

我试的是前置摄像头 device-position="front",iphone上确认照出来的照片和系统照的照片是左右颠倒的。

前置摄像头preview是有镜像效果的,实际拍照则不会有这种镜像效果,但微信排出的照片和preview一样有镜像效果

韬々:

iphone的小程序内前置摄像头表现与系统是一致的。具体可以参考demo例子尝试。

<!-- camera.wxml -->
<camera device-position="back" flash="off" binderror="error" style="width: 100%; height: 300px;"></camera>
<button type="primary" bindtap="takePhoto">拍照</button>
<view>预览</view>
<image mode="widthFix" src="{{src}}"></image>

// camera.js
Page({
  takePhoto() {
    const ctx = wx.createCameraContext()
    ctx.takePhoto({
      quality: 'high',
      success: (res) => {
        this.setData({
          src: res.tempImagePath
        })
      }
    })
  },
  error(e) {
    console.log(e.detail)
  }
})

https://developers.weixin.qq.com/miniprogram/dev/component/camera.html

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付