Ionic Base64 to Gallery


Ionic Base64 to Gallery Native Plugin – Basically this plugin allows us to save the base64 data in png form in our device. cordova-base64-to-gallery plugin is used to convert base64 data to image gallery. Here in this tutorial we are going to explain how you can use this plugin in Ionic.


Ionic Base64 to Gallery Native Plugin Example

First install the cordova plugin cordova-base64-to-gallery to use this feature.

Installation

You can install the plugin using the below command-

Ionic Base64 to Gallery Native Plugin Example:

$ ionic cordova plugin add cordova-base64-to-gallery
$ npm install --save @ionic-native/base64-to-gallery
  • IOS
  • Android
  • Windows Phone 8

Example

Ionic Base64 Gallery plugin Example:

import { Base64ToGallery } from '@ionic-native/base64-to-gallery';

constructor(private base64ToGallery: Base64ToGallery) { }


...


this.base64ToGallery.base64ToGallery(base64Data, { prefix: '_img' }).then(
  res => console.log('Saved image to gallery ', res),
  err => console.log('Error saving image to gallery ', err)
);

Instance Members

  • base64ToGallery(data, options)– Converts a base64 string into image and saves this image in system’s gallery.

Advertisements

Add Comment

📖 Read More