# wx.chooseImage(Object object)

with Promise style call: Supported

Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6

Select pictures from local albums or use the camera to take photos.

# parameter

# Object object

attribute type Default values Required Introductions
count number 9 no Maximum number of pictures you can choose
sizeType Array.&ltstring&gt ['original', 'compressed'] no The size of the selected picture
sourceType Array.&ltstring&gt ['album', 'camera'] no Select the source of the image
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

object.sizeType Legal value

value Introductions Minimum version
original Original
compressed Compression diagram

object.sourceType Legal value

value Introductions Minimum version
album Select from an album
camera Using the camera

# object.success callback

# parameter
# Object res
attribute type Introductions Minimum version
tempFilePaths Array.&ltstring&gt List of local temp file paths for pictures (Local path)
tempFiles Array.&ltObject&gt List of local temporary files for pictures 1.2.0

res.tempFiles Structure

attribute type Introductions
path string Local temporary file path (Local path)
size number Local temporary file size, unit B
wx.chooseImage({
  count: 1,
  sizeType: ['original', 'compressed'],
  sourceType: ['album', 'camera'],
  success (res) {
    // TempFilePath can display pictures as src attribute of img tag
    const tempFilePaths = res.tempFilePaths
  }
})