How do I save a canvas snapshot to my server

Get help using Construct 2

Post » Wed Jan 11, 2017 11:57 am

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
B
5
Posts: 24
Reputation: 273

Post » Thu Jan 12, 2017 5:07 pm

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.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Thu Jan 12, 2017 7:58 pm

@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 :D
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Thu Jan 19, 2017 1:56 pm

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
B
5
Posts: 24
Reputation: 273

Post » Thu Jan 19, 2017 2:49 pm

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.
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Tue Jan 24, 2017 4:24 pm

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
B
5
Posts: 24
Reputation: 273


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests