Closed renege closed 5 years ago
@moberwasserlechner my ionic app is build in vue with capacitor by the way
@moberwasserlechner even this fails:
Plugins.FileSharer.share({
filename: Math.random()+"_foo.png",
base64Data: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M/wHwAEBgIApD5fRAAAAABJRU5ErkJggg==',
contentType: "image/png",
}).then(() => {
alert('DONE');
}).catch(error => {
console.error("File sharing failed:", error.message);
});
That shows the alert() and redirects me to a white screen of death.. Nothing Share-a-like about this.
Hi,
Which versions of capacitor and ios are you using? Does it work on the Web and Android?
I try to have a look but can not make any promises.
BR, Michael
Dataurls normally look like data:image/png;base64,
+ image content. See the comma at the end.
In your code above you do not replace the comma, which might cause the error?
Thanks, was the comma!
Just to emphasise for other users: you don't need the data:image/png;base64,
part in the base64Data parameter. So, use something like
.replace(/^data:image\/[a-z]+;base64,/, "")
Or , If someone want the easiest way you can just base64Data: img.split(',')[1],
FileSharer.share({ filename: "abc.png", base64Data: 'base64 string here', contentType: "image/png", }).then(() => { alert('DONE'); }).catch(error => { console.error("File sharing failed:", error.message); });
Its showing the alert Done but nothing is happening. Can anyone help me with this?
@Maheshbhusanoor Probably because Capacitor 3 is not supported :( https://github.com/moberwasserlechner/capacitor-filesharer/issues/31#issuecomment-907005914
Hey guys, confirming this issue is still happening on Capacitor 4.0.0
I use this plugin on Capacitor 4.0.0,the app will be closed when share image to wechat or other im,how to solve this problem,thanks.
Please do not comment on closed issues but create a new one and provide the information the issue template asks. I will not look on closed issues when planing a new release and therefore you will not get any answers to your questions.
Hi, I'm trying the following code on iOS:
I'm 100% the picture is correct, because it's shown correctly on the image src.
But it always gives me:
⚡️ [error] - File sharing failed: The string contains invalid characters.
And when I do:
base64Data: img.replace('data:image/png;base64', '').replace('image/png;base64', '').replace(/\s/g, ''),
It gives me:ERR_PARAM_DATA_INVALID