my.chooseImage

Choose an image from the camera or gallery of a device.

Sample Code

copy
my.chooseImage({
  count: 2,
  success: (res) => {
    img.src = res.apFilePaths[0];
  },
});

Parameters

NameTypeMandatoryDescription
countNumberNoMaximum number of images to be   selected, 1 by default
sizeTypeStringArrayNooriginal image, compressed image,   both by default
sourceTypeString ArrayNoCamera or album, [‘camera’,‘album’]   by default
successFunctionNoCallback function upon call success
failFunctionNoCallback function upon call failure
completeFunctionNoCallback function upon call   completion (to be executed upon either call success or failure)

Success Callback Function

The incoming parameter is of the Object type with the following attributes:

NameTypeDescription
apFilePathsString ArrayImage file description

Error Code

errorDescription
11User cancels operation