Bug Report
Capacitor Version
@capacitor/cli 2.4.0
@capacitor/ios 2.4.0
@capacitor/android 2.4.0
@capacitor/core 2.4.0
@capacitor/electron not installed
Platform(s)
iOS
Current Behavior
Currently I'm not able to see the saved images in the Photos. For Android after I save an image I can see it in the gallery, on iOS the image is saved, i can see it in the directory but is not shown in the Photo Gallery.
Expected Behavior
All saved photos should be available in the iOS Photos Gallery exact as it is on Android.
Code Reproduction
async savePhoto() {
try {
const { Filesystem } = Plugins;
const base64Data = await this.readAsBase64(this.imageFull);
const fileName = `${new Date().getTime()}.jpg`;
const image = await Filesystem.writeFile({
path: fileName,
data: base64Data,
directory: FilesystemDirectory.Data // I've tried with all types
});
if (image.uri) {
console.log('Image has been saved into your gallery');
}
} catch (e) { console.error(e); }
}
private async readAsBase64(url: string): Promise<string> {
const response = await fetch(url);
const blob = await response.blob();
return await this.convertBlobToBase64(blob) as string;
}
private async convertBlobToBase64(blob: Blob): Promise<string | ArrayBuffer> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onerror = () => reject();
reader.onload = () => resolve(reader.result);
reader.readAsDataURL(blob);
});
}
Other Technical Details
npm: 6.14.6
node: 14.6.0
pod: 1.8.4
Bug Report
Capacitor Version
Platform(s)
iOS
Current Behavior
Currently I'm not able to see the saved images in the Photos. For Android after I save an image I can see it in the gallery, on iOS the image is saved, i can see it in the directory but is not shown in the Photo Gallery.
Expected Behavior
All saved photos should be available in the iOS Photos Gallery exact as it is on Android.
Code Reproduction
Other Technical Details
npm: 6.14.6
node: 14.6.0
pod: 1.8.4