How do I send a CanvasSnapshot to a PHP script

0 favourites
  • 6 posts
From the Asset Store
The soundstage is set for an immersive listening experience sending your audience adrift.
  • 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!

  • 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.

  • This is a shameless bump! Bump bumpity bump bump! Back to the top you go!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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!

  • +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
    [/code:1inyi73t]
    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.
  • Thanks! If it's really that simple I'm going to kick myself in the rear later.

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