question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

share image base64 not showing on social

See original GitHub issue

here my code:

captureScreen({
            format: "png",
            quality: 0.8,
            result:'data-uri'
          })
          .then(
            uri =>{
                console.log("Image saved to", uri)
                let shareImage = {
                    title: 'share image',//string
                    message: 'share image description',//string
                    url:uri,
    
                };
                Share.open(shareImage).catch(err => console.log(err));
            },
            error => console.error("Oops, snapshot failed", error)
          );

my console.log: image but image not showing anymore when sharing, for example share with email: image

Environment

  • React Native version: 0.55.4
  • React Native platform + platform version: Android 8.0

react-native-share

Version: 1.0.27

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Sanan4licommented, Jan 21, 2020

I am having the same issue. When I tries to share base64 image to any social app it does not share the actual image but shares a unsupported image like “24232212456755.null”. My base64 string is actually a real image I have tested it by converting base64 string to an image online.

I solved it by correcting the format " url: “data:image/jpeg;base64,”+uri, " I have been using jpg instead of jpeg as it was said “extension name” in docs.

2reactions
mlazaricommented, Dec 24, 2018

Actually it works fine if I put that data URL in a constant like in the examples from Readme. But if I use the value from https://github.com/iddan/react-native-canvas#canvastodataurl it doesn’t work. I log it in console and it has the same value.

L.E. Nevermind, it looks like the value returned by https://github.com/iddan/react-native-canvas#canvastodataurl is included in quotes for some reason. If I trim those quotes with const url = dataURL.replace(/^"+|"+$/g, ''); it works well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error sharing base64 image on SocialShare plugin
The image is somehow getting converted to jpeg , I guess. TRY either, drawing a white background before drawing the text or specifying...
Read more >
Share image using Social Sharing Plugin | OutSystems
From your screenshots, it seems you are trying to share with Facebook a file by using a Base64 encoded data-URL, which could explain...
Read more >
Share Image With Web Share API - Kush Kumar
Initially, I tried to store the user banner to firebase and sharing the file URL to social media but sharing the file as...
Read more >
Navigator.share() - Web APIs - MDN Web Docs
` return } if (navigator.canShare({ files })) { try { await navigator.share({ files, title: 'Images', text: 'Beautiful images' }) output.textContent = 'Shared!' } ......
Read more >
Automatic Social Share Images | CSS-Tricks
Any time the image is requested, check to see if you've already created it. If so, serve it from Cloudinary; if not, make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found