Allow gamer to upload an image : is it possible ?

0 favourites
  • 6 posts
From the Asset Store
You can upload screenshots and photos to your server very easily.
  • Hi guys, I would like to do this feature my game :

    1) User can upload an image (it could be entering an URL to an image)

    2) Game load the image into an existing sprite.

    3) Sprite is saving loaded image (2) so if the game is restarted, the image don't have to be reloaded from internet.

    I have test step 1) et 2) using Load image from. But I don't know how to do the 3). Anyone has idea ? I would like it to work if possible on mobile too (I'm using cocoonJS) <img src="smileys/smiley1.gif" border="0" align="middle" />

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This would mean a change of constructs files, I don?t think this works.

    If there is a way, you have to overwrite the existing image on the user device or change the c2 file.

    I?m really not sure if this is possible at the runtime.

    You could save it on the device, and write the path in a cache. This would save the user from downloading it again.

  • Like Darklinki said, changing the project files during runtime seems... dangerous ?

    Most of all, if this is a webapp, modifying the project would modify it for everyone.

    I can think of a way, not sure it will work with every image though.

    What you need is the content of the image you load. So you have to load the image with an AJAX request, and save the lastData. Then, load the image from URL (AJAX.lastData). Don't put it only in the sprite, save it in one of the sprites variable, so it will be included in the savefile (making it a lot bigger though). On load finished, then Sprite : load image from URL (sprite.myvarible) should then bring back the image.

  • thank you for your answers, I'm going to try that.

  • it's possible via plugins, search on the plugin list, on the plugin side of this Forum...

  • I had actually built this feature for a guy using c2. It was basically a php file that uploaded the picture to the server. The ajax call was made with the picture string and encoded/saved and in this case uploaded to Facebook. Look on stack exchange for example php code then use the ajax in c2 to transmit the picture. What you would want to do is name the file based on user unique I'd ie player1.jpg to you know when they log in you can load image via URL by just throwing their userid and jpg.

    Long story short it is possible but it may be beyond the average users level of experience.

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