0 Favourites

How do I take and store screenshots?

  • I used this capx to have an idea c:\Program Files\Construct 2\examples\Taking screenshots.capx

    But where does it download the snapshow? i didnt find it anywhere, im using note webkit as a preview , does it matter?

    PS: another question: if i would like the snapshot to picture the whole layout instead of the screen, how could i do?

  • Basically this is my same questions

    It recived no answer, i'm going loco as well now

  • OK I just spent like 3 days figuring this out.. so.. here goes!

    You take a screenshot with CanvasSnapshot. You already know that. My chrome bugs out if I try to use the snapshot on the same frame it was generated so I put a 0.1 second wait after it.

    You can take that screenshot and download it locally like in the example app. If you want to send it elsewhere, the CanvasSnapshot system expression contains a Base64 encoded PNG image prepended with the MIME type and set off the from the actual data with a comma. If you strip off the crap in the front and URLEncode the data you can send that via an Ajax POST action. You can do both of these in a single action; I set my post variable to ""imagedata=" & URLEncode(replace(CanvasSnapshot, "data:image/png;base64,", ""))" and just post that since I use GET parameters for everything else.

    On the server side, remember that PHP automatically URL decodes so you just need to do base64_decode on your POST data. Don't do a manual urldecode or you'll corrupt your data. Once you do all that you'll have your PNG screenshot data in PHP and you can do whatever you want with it.

    As for screenshotting certain things, all you can do in Construct is take a snapshot of the entire canvas. You can edit it in GD on the server side if you want to though to crop out what you don't want.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • nusbaumc I'm doing something similar however I need to email that image I'm capturing ... I'm stuck only because my php script doesn't seem to be receiving the POST... or i may be over-processing it into nothingness...because I'm receiving a 0kb attachment.

  • Thanks for your work nusbaumc! Is there a possibility you could explain how to just get the raw base64 string?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread sticky
4,517 857,217
Tinimations's avatar
Tinimations
Unread hot topic Locked topic
223 15,824
Tom's avatar
Tom Construct Team Founder
Unread hot topic
99 10,136
karshinkoff's avatar
karshinkoff