let pathUrl = ''
try {
let pickerProfile: picker.PickerProfile = {
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK,
saveUri: "/data/storage/el2/base/haps/phone/cache/compressUploadImg/1722246248971pictures.jpg"
};
let pickerResult: picker.PickerResult = await picker.pick(getContext(),
[picker.PickerMediaType.PHOTO], pickerProfile);
if (pickerResult.resultCode == 0) {
pathUrl = pickerResult.resultUri;
}
} catch (e) {
console.error($r("app.string.take_photo_err") + JSON.stringify(e));
}
return pathUrl;
参考下面示例,了解路径参数的格式: