(保存Base64到相册)Base64 To Gallery

Base64 To Gallery

此插件允许您将base64数据作为png图像保存到设备中
Repo(备用): https://github.com/Nexxa/cordova-base64-to-gallery

Installation(安装)

1.安装Cordova和Ionic原生插件:

$ ionic cordova plugin add cordova-base64-to-gallery
$ npm install --save @ionic-native/base64-to-gallery

2.添加插件到app's module

Supported platforms(支持平台)

Android
iOS
Windows Phone 8

Usage(用法)

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)

将base64字符串转换为设备库中的图像文件

参数 类型 详情
data string 要保存的实际base64字符串
options any 具有属性的对象:prefix:string,mediaScanner:boolean。 前缀将被添加到文件名。 如果是true,mediaScanner会在Android上运行Media Scanner,并保存到iOS上的Camera Roll; 如果为false,则保存到iOS上的“库”文件夹。可选

****Returns:** Promise
在保存图像后返回可解析的Promise。

你可能感兴趣的:((保存Base64到相册)Base64 To Gallery)