Skip to main content
added 2810 characters in body
Source Link
Sparsh
  • 1.5k
  • 1
  • 17
  • 35

A base64Image must be passed in the image object of FBInstant.shareAsync() function. In your case, pass onto your img var. For sample working, img var below has an image of 1.9 kb in the form of base64 code.

var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACoCAMAAABt9SM9AAAAulBMVEUAAAAA/wAAAgAAAAMNnQ0AAAIDAAUNiA8GKAYAAAUO8BAJ/QgJ+goKKgkGLAcJugsNcA8LfQsSqxIKagwIFAgU1xUIrAgFAAkK3gcU0BIIWAcNiAsIAAANtA0JFgcLAAUJHggRYA8KJAkM6REKSgYQKAgJGwUXzBkReRQYixkJ5QgKwgsRVBAPuRENEgwO3RAIkwoLNAUMRgsLPQwKZQ0HMQURUBoGDRENAA4SMxMPQRUIogUDSwQblRhv/1T3AAAGaUlEQVR4nO2Yi3baOBCGZSsaYmxICCSCYDCQNqFpC7ntblq67/9aq5FkY0MgAdLL2fN/bQ62LqPRr9HNQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL8Ibf6I3DOJiFPCjYVtjlRKruWYRKVCOtwfxS6IVHMTSmmbpPe0pV/wR2nFP7S5k1sY9Hq98yf3TINzfknXtchbD096loFedoCaLu38X1L7eLDSxMQaGz2zZTU755fJrkamvRvr0Xg9S2nb4/FeA3AeBEHccs90a16CGm0MED27SpLYlOnSsjH9GCcxJ56Id4gsarKpeMKmZHrNDiXfdjVSSxKuGJyuZ2nq2pw9xTK9n3pHrZ2a0lkYhiIsSMPUFTBzRE+5zLwkaGRm7xEnnpAPSQppWV2EO8WbzsUKMxVGTqyGSQ9LiCyfRCm/ypDXB5/lXBKqbowE7cJsmAnnDGU2Ik73GtdzYzPwkSW8WERppsgsTf4/ZaX+tgIbWZWpGl1YsVTuAUVFdbmjV7IZWLEirTRFQytWU3BEUOGPFjpvhxvK0lTYXCrFe537tRRLS811SWntxNprxdgg1t+L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X47B3ihOCLFnx0SOv82o4qnWz6Yv5bSLwwRfUXU8lNantcDk5Tc5ukClH66leTOdf2YrkFvpVGRLXyCjuwe5+kQVCBxdJqXk28pZBoVr7uBOQuIeaa68QS26ZA9pft0jHJVIbafnWIv5kKulc2+SS1u+64+VXpZLOyMwXBIgq1ue5UXTd3Frm6z7y0qVaZ9mu1fn4vbdXMy4/UnCIe+n2T4ehf2jhX8pLL2nSXZxfMU/tcFJ4KkqRaxbvJcQGvj8/O5kFyV3vaPn5DW7UTmTlBamZa+9S/5jnT9g71+d+9cjZNpvG++mVjmDvjKvQvFQl5b6vVcldNj4dHi7MVPr7D97j3IXq0Q9rJfrcjnlESrPK48RPxrya7t9fPyb4f1N+M2jrNC0ZX9VXu/5SBFCobdmazjv5TxNJDppPDL9le5wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA/5f/AOmBdzOElsTMAAAAAElFTkSuQmCC"; FBInstant.shareAsync({ intent: 'INVITE', image: img, // base64Image code must be passed in img text: 'Play this Awesome game', data: {myReplayData: '...'}, }).then(function() { location.reload(); }); 

For testing now, use this site to upload your image, convert it to base64 and copy the image code that starts with data:image/ ending in a very long hash. Store the copied code into your variable named img. It must work then.

FBInstant.shareAsync({ intent: 'INVITE', image: img, // base64Image code must be passed in img text: 'Play this Awesome game', data: {}, }).then(function() { location.reload(); }); 

For testing now, use this site to upload your image, convert it to base64 and copy the image code that starts with data:image/ ending in a very long hash. Store the copied code into your variable named img. It must work then.

A base64Image must be passed in the image object of FBInstant.shareAsync() function. In your case, pass onto your img var. For sample working, img var below has an image of 1.9 kb in the form of base64 code.

var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACoCAMAAABt9SM9AAAAulBMVEUAAAAA/wAAAgAAAAMNnQ0AAAIDAAUNiA8GKAYAAAUO8BAJ/QgJ+goKKgkGLAcJugsNcA8LfQsSqxIKagwIFAgU1xUIrAgFAAkK3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9g71+d+9cjZNpvG++mVjmDvjKvQvFQl5b6vVcldNj4dHi7MVPr7D97j3IXq0Q9rJfrcjnlESrPK48RPxrya7t9fPyb4f1N+M2jrNC0ZX9VXu/5SBFCobdmazjv5TxNJDppPDL9le5wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA/5f/AOmBdzOElsTMAAAAAElFTkSuQmCC"; FBInstant.shareAsync({ intent: 'INVITE', image: img, // base64Image code must be passed in img text: 'Play this Awesome game', data: {myReplayData: '...'}, }).then(function() { location.reload(); }); 

For testing now, use this site to upload your image, convert it to base64 and copy the image code that starts with data:image/ ending in a very long hash. Store the copied code into your variable named img. It must work then.

Source Link
Sparsh
  • 1.5k
  • 1
  • 17
  • 35

FBInstant.shareAsync({ intent: 'INVITE', image: img, // base64Image code must be passed in img text: 'Play this Awesome game', data: {}, }).then(function() { location.reload(); }); 

For testing now, use this site to upload your image, convert it to base64 and copy the image code that starts with data:image/ ending in a very long hash. Store the copied code into your variable named img. It must work then.