# Base64 to Gallery plugin not work in Ionic 4 and 5

**URL:** <https://forum.ionicframework.com/t/base64-to-gallery-plugin-not-work-in-ionic-4-and-5/209134>\
**Category:** Ionic Framework\
**Created:** [May 6, 2021, 8:54am UTC](https://forum.ionicframework.com/t/base64-to-gallery-plugin-not-work-in-ionic-4-and-5/209134 "2021-05-06T08:54:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avirup1993](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/avirup1993/32/138532_2.png) [@Avirup1993](https://forum.ionicframework.com/u/Avirup1993)\
**Post date:** [May 6, 2021, 8:54am UTC](https://forum.ionicframework.com/t/base64-to-gallery-plugin-not-work-in-ionic-4-and-5/209134/1 "2021-05-06T08:54:01Z")

</div>

Plugin is :: [Base64 To Gallery - Ionic Documentation](https://ionicframework.com/docs/native/base64-to-gallery)

When I saved a image into gallery then show this error “Error while saving image”

Code ::  
downloadQR(){  
const canvas = document.querySelector(‘canvas’) as HTMLCanvasElement;  
const imageData = canvas.toDataURL(‘image/jpeg’).toString()  
console.log(imageData)  
let data = imageData.split(’,’)[1];  
console.log(data)  
this.base64.base64ToGallery(data, {  
prefix:’\_img’,mediaScanner : true}).then(async res=\>{  
console.log(res)  
let toast = await this.toastCtrl.create({  
header : ‘QR code save’  
})  
toast.present()  
}, err =\> console.log(“err”,err)  
)  
}

What is problem of my code? any other solution ??

---

<div class="post-metadata">

**Author:** ![Avirup1993](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/avirup1993/32/138532_2.png) [@Avirup1993](https://forum.ionicframework.com/u/Avirup1993)\
**Post date:** [May 12, 2021, 2:53am UTC](https://forum.ionicframework.com/t/base64-to-gallery-plugin-not-work-in-ionic-4-and-5/209134/2 "2021-05-12T02:53:44Z")

</div>

This problem solved with use [Photo Library - Ionic Documentation](https://ionicframework.com/docs/native/photo-library) this plugin for image save in gallery.

---

<div class="post-metadata">

**Author:** ![roelhackett](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@roelhackett](https://forum.ionicframework.com/u/roelhackett)\
**Post date:** [May 22, 2021, 7:34am UTC](https://forum.ionicframework.com/t/base64-to-gallery-plugin-not-work-in-ionic-4-and-5/209134/3 "2021-05-22T07:34:49Z")

</div>

Thanks, Avirup for the further head-on with this, was facing a similar issue at my end too

Regards,  
Roel Hackett

---

<div class="post-metadata">

**Author:** ![roelhackett](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@roelhackett](https://forum.ionicframework.com/u/roelhackett)\
**Post date:** [May 23, 2021, 10:03am UTC](https://forum.ionicframework.com/t/base64-to-gallery-plugin-not-work-in-ionic-4-and-5/209134/4 "2021-05-23T10:03:38Z")

</div>

The link helped a lot to get the issue solved.

Regards,  
[Tutuapp](https://dltutuapp.com/tutuapp-download/) [Showbox](https://showbox.run/)
