capacitor-community / capacitor-community/camera-preview
How to properly obtain the image file using storeToFile: true
- Dominant language
- Java
- Stars
- 227
- Forks
- 185
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
I've been trying to save a photo using this plugin.
I'm setting `storeToFile: true` in the CameraPreviewOption to start the camera beforehand.
```javascript
const options: CameraPreviewOptions = {
storeToFile: true,
width: window.screen.width,
height: window.screen.height,
parent: "cameraPreview",
position: "rear",
className: "cameraPreview",
enableOpacity: true,
toBack: true,
lockAndroidOrientation: true,
rotateWhenOrientationChanged: false,
}
CameraPreview.start(options);
```
But then when I try to capture an image, as a result I still get a base64 string.
```javascript
const cameraPreviewPictureOptions: CameraPreviewPictureOptions = {
quality: 90,
};
const result = await CameraPreview.capture(cameraPreviewPictureOptions);
```
I wanted to check if this is the correct way to use the storeToFile property, since I need a file instead of a base64 string. Accessing results.value just gives me the entire base64 string.
Contributor guide
Assessment
This issue has not been assessed yet.