How do I send a CanvasSnapshot to a PHP script

Get help using Construct 2

Post » Fri Mar 14, 2014 12:28 am

My collaborator and I are working on our second project and as part of that I want to send a screenshot to a PHP script. I know how to get a screenshot into CanvasSnapshot, but I've been using Ajax with GET expressions for PHP interaction. I want to use a POST request to submit the screenshot but the Ajax dialog says it's supposed to be in query string form and I don't know how to process it.

Any tips are appreciated!
B
9
S
3
Posts: 37
Reputation: 749

Post » Fri Mar 14, 2014 3:51 am

Specifically, I mean from the manual page. The bolded part is the part I can't figure out, can't seem to find any information about it either.

CanvasSnapshot
Contains the resulting image from a Snapshot canvas action after On canvas snapshot has run. (Note this expression is not available immediately after the Snapshot canvas action - you can only use it after On canvas snapshot triggers.) The expression returns a data URI of the image file. This can be loaded in to a Sprite or Tiled Background object via Load image from URL, sent to a server or stored locally, or opened with the Browser object in a new tab to save to disk.
B
9
S
3
Posts: 37
Reputation: 749

Post » Fri Mar 14, 2014 11:59 pm

This is a shameless bump! Bump bumpity bump bump! Back to the top you go!
B
9
S
3
Posts: 37
Reputation: 749

Post » Mon Mar 17, 2014 11:55 am

I'm bumpin' it again!

If I don't hear something I'm going to assume it's just not possible and I'm going to have to stop being lazy and write a plugin for it!
B
9
S
3
Posts: 37
Reputation: 749

Post » Mon Mar 17, 2014 2:16 pm

Code: Select all
+On what you want
   -> System: Take snapshot of canvas
+ System: On canvas snapshot
   -> Ajax: Post "img="&CanvasSnapshot to URL "http://www.domain.com/uploadSnapshot.php" (tag "snapshot")
+ Ajax: On "snapshot" complete
   -> you can use that to display a confirmation message of some kind
+ Ajax: On "snapshot" error
   -> you can use that to display an error message of some kind

little part I'm not sure about is if you need to write "img"&CanvasSnapshot" or "?img&CanvasSnapshot", I'm 80% sure it's the former.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Tue Mar 18, 2014 12:28 am

Thanks! If it's really that simple I'm going to kick myself in the rear later.
B
9
S
3
Posts: 37
Reputation: 749


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 15 guests