Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
127 views
in Technique[技术] by (71.8m points)

javascript - How to convert BASE64 to URL? Typescript - Angular - Ionic

someone knows how to pass a BASE64 to a URL, I have an application (Ionic) that generates a BASE64 and to share that image I need the URL.

I am using the capacitor plugin to share the image:

import { Plugins } from '@capacitor/core';
const image = 'base64-string........'

async sharedLink(image: any) {
    await Plugins.Share.share({
      url: image
    });
}

When I share it from my app, only the base64 string is seen, I need the converted image to come out:

EXAMPLE 1EXAMPLE 2

question from:https://stackoverflow.com/questions/65892616/how-to-convert-base64-to-url-typescript-angular-ionic

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use the following capacitor plugin: https://ionicframework.com/docs/native/social-sharing

First install the plugin.

npm install cordova-plugin-x-socialsharing
npm install @ionic-native/social-sharing
ionic cap sync

app.module.ts

import { SocialSharing } from '@ionic-native/social-sharing/ngx';

providers: [
     SocialSharing
]

your-page.page.ts

import { SocialSharing } from '@ionic-native/social-sharing/ngx';

constructor(private socialSharing: SocialSharing)

const image = 'base64-string........'

async sharedLink(image: any) {
    this.socialSharing.share(null, null, image, null);
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...