跳到主要内容

bn.chooseImage

chooseImage(options): Promise<ChooseImageResponse>

description Selects an image from the local album or takes a photo with the camera.

example

const res = await bn.chooseImage({
count: 9,
sizeType: ['original'],
sourceType: ['album'],
})
console.log(res.tempFilePaths, res.tempFiles)

Parameters

NameType
optionsChooseImageOptions

Returns

Promise<ChooseImageResponse>

Interface: ChooseImageOptions

NameTypeDescription
count?numberThe maximum number of images allowed range is [1,9]
sizeType?("original" | "compressed")[]The size of the select image; valid options:- 'original';; - 'compressed'
sourceType?("album" | "camera")[]The source of the image; valid options:- 'album'; - 'camera'
compressionThreshold?numberThe max size of image, unit bit; JSSDK version >= 4.31.0

Interface: ChooseImageResponse

NameTypeDescription
tempFilePathsstring[]The list of local temporary file paths to images
tempFilesImageFile[]The local temporary file list for images