Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui.resource.image not loading base64 data in native android #24

Open
jeeva1803 opened this issue Mar 16, 2015 · 1 comment
Open

ui.resource.image not loading base64 data in native android #24

jeeva1803 opened this issue Mar 16, 2015 · 1 comment

Comments

@jeeva1803
Copy link

while creating a new image(ui.resource.image) using the constructor, it is given in the documentation that the source can be either a url or a base64 encoded uri(url {string} —A URL or a base64 encoded image string.) .
This is working as expected in the browser(tested with both local file path and with base64 encoded image string). But when trying to load the image using a base64 encoded image uri(actually a screen shot of the screen captured using the line( GC.app.__root._ctx.canvas.toDataURL();) it takes the content(base64 encoded image string) as the path to load instead of considering it as data (IN ANDROID DEVICE).
I am also unable to save the screen shot(base64 data) in to local disk as a file.Is there a workaround to load actual data in to image object in NATIVE ANDROID.

@jeeva1803 jeeva1803 changed the title ui.resource.image not working as given in documentation in native android ui.resource.image not loading base64 data in native android Mar 16, 2015
@collingreen
Copy link
Contributor

This looks like the same issue as https://groups.google.com/forum/#!topic/game-closure-devkit/zz_JkSENAWY

Cross posting for reference:

It looks like you need to specify what type of data is being base64 encoded on native. Here is a snippet from the sharing module testapp:

https://github.com/gameclosure/sharing/blob/master/testapp/src/Application.js#L180-L183

    var url = canvas.toDataURL('image/png');
    if (IS_NATIVE) {
      return 'data:image/png;base64,' + url;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants