my.chooseImage

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

Sample Code

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

Parameters

PropertyType

Required

Description
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:

PropertyTypeDescription
apFilePathsString ArrayImage file description.

Error Code

ErrorDescription
11User cancels operation.