Skip to content

Share image #2459

@millordd

Description

@millordd

I'm using Capacitor 6.0.3 with @capacitor/share.

According to the docs, ShareOptions supports:

  • title
  • text
  • url (http, https, file://)
  • files (array of file:// URLs)

My problem:
I have an image generated in WebView (screenshot) as a data URL / Blob / base64 string.
I want to share this image using Share plugin without manually creating a file URI.

What I tried:

  • Passing data:image/png;base64,... to url → not supported
  • Passing blob: URL → not supported
  • Creating File object in JS → native layer can't access it
  • navigator.share → unreliable in Android WebView

Current working solution:
Save base64 to Filesystem (Cache) → getUri → Share.share({ files: [uri] })

Question:
Is there any supported or recommended way in Capacitor 6 to share an image
directly from memory (base64/blob) without writing it to the filesystem,
or is writing a temporary file the only correct approach?

Environment:

  • Capacitor 6.0.3
  • @capacitor/share 6.0.3
  • Android WebView (Ionic/Capacitor app)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions