Facebook Instant Games share Image issue

i need to add the facebook share button to my facebook instance game.

when i used folowing code

local json = {“intent” :“SHARE”,“image”:"",“text”:“message”}
fbinstant.share(json,function(self, success)
end)

but it requires 64based encode image string. After using an online converter I got a 64based string.but defold engine did not allow to paste that string.i used 745 kb image to create encoded string

ARE THERE ANY SUGGESTIONS or library i can use to create 64 based encode string form image

This is the report

Expected behaviour

Actual behaviour

Steps to reproduce


Build time 2019-01-21T16:41:39.690364
Defold channel editor-alpha
Defold editor sha 58f9a169ac6654b60c56bd013eb2765f4834fa16
Defold engine sha 9f376d88408bad9088a4187d4f874ae4767a0185
Defold version 1.2.145
GPU Intel Iris OpenGL Engine
GPU Driver 2.1 INTEL-10.32.48
Java version 1.8.0_102-b14
OS arch x86_64
OS name Mac OS X
OS version 10.13.4
1 Like

Sharing a pre-generated base64 encoded image should work.

What do you mean by this? Do you get an error?

Please try sharing the blank image as in the example here: https://github.com/defold/extension-fbinstant/issues/9

If that works next step would be to try and share a smaller image and see if that works.

I used 745kb image to encrypt.It generate long string and when i trying to paste that string , defold engine provide an error. then i try with 75kb image and it paste successfully.i think the problem occurs when user trying to paste long string.when i check the string it contain 745900 characters.

You could probably store this as a file on disk using Custom Resources and read it at run-time and pass the string to fbinstant.share().

1 Like

Thank you Britzl,it works

local data = sys.load_resource("/assets/shareImage.json")
fbinstant.share(data,function(self, success)
end)

1 Like

Wow Britzl, this is really great . I have been figuring out so many issues with the this code and this local data = sys.load_resource("/assets/shareImage.json").

1 Like