How do allow the user to upload images from their desktop?

0 favourites
  • 3 posts
From the Asset Store
You can upload screenshots and photos to your server very easily.
  • I want to make it so the user can load an image from their desktop into the game. Right now I can load the png file contents with the ajax object, but I don't know how to use it with the "Sprite - Load image from URL" since that seems to be the only way to change a sprite's image. I guess I would have to try to change it into base64 data but I don't know if that would be possible with png...

    I guess it doesn't have to be a sprite, is there another object other than sprite that would work for loading images from the desktop?

    Ashley's response in construct3.ideas.aha.io/ideas/C3-I-762 makes it sound like you can convert binary data to base64, could this be loaded by the sprite object as a data URI?

  • With Binary Data, there is rarely any need for base64 any more, which is good because base64 is inefficient.

    You can use the NW.js object's 'Read binary file' action to read an image file in to a Binary Data object, and then use the Binary Data object's 'GetURL' expression to load it in to a Sprite.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • With Binary Data, there is rarely any need for base64 any more, which is good because base64 is inefficient.

    You can use the NW.js object's 'Read binary file' action to read an image file in to a Binary Data object, and then use the Binary Data object's 'GetURL' expression to load it in to a Sprite.

    That worked wonderfully! Thanks so much, I spent too much time yesterday trying to figure this out yesterday with much more difficult methods

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)