How do I save a canvas snapshot to my server

0 favourites
  • 6 posts
From the Asset Store
Create your own wss server and ws server with ssl and without ssl.
  • Hi there,

    I have an ongoing problem that I have been working on for some time with very limited sucess so far and would love to hear your comments on it and perhaps suggestions on acheiving my goals (if at all possible).

    The problem may seem complicated in my explination, however I will do my best to explain it simply. Here goes...

    1. I am making an app/game that captures data and displays it on screen (simple so far, it's working).

    2. I have a button that captures a screen shot when pressed (still simple and still all working).

    3. I have a "download" button that allows the user to save the captured image to their device (it works).

    4. Next I want the captured image to save to my own server or webspace or somewher where I can access them from (not so simple, maybe not possible).

    5. The images would need to be saved in a sequential numbering system so they don't get replaced by the next saved file of the same name.

    Things to note:

    1. I have tried an email pluging to get the images sent directly to my e-mail address but can't get it to work. This would be the ideal solution.

    2. The canvas snapshot that I have used with my app/game is the example that comes with c2 and it works fine for storing the image to the users local device.

    3. All I want to do is have the same image save to a location of my choosing when the user clicks the "download" button.

    I hope this makes sence and would love to hear your thoughts and any feedback you may have for this.

    Kind regards, Dan

  • You will want to use a http POST request. I am not sure exactly how this would work in C2, but I know it is possible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • RogerThompson try this tutorial... I'm not sure if everything I did back then still works with recent c2 changes but it does have the part you need in it. Let me know if it works I've been meaning to make a new version ... life has gotten in the way

  • Many thanks for both suggestions. I have researched the POST request and am also unsure on how this would work in C2 and have looked at your tutorial Ragevortex and am not sure if i have the ability to adapt it to what I want to achieve.

    If there is anything else I could try or any other ideas out there im willing to tryt them all out.

    Kind regards, Dan

  • The canvas snapshot is returned as a data URI, simply post this data to a server page with a script to save this data URI to an image file on the server. Obviously you need some kind of server-side scripting setup, be it PHP or ASP.

  • Thanks Magistross this sounds very useful however I still have no idea on what to do. None of this is simple or obvious to myself.

    If anybody knows of a tutorial for this then could you please let me know.

    Many thnaks, Dan

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