Skip to main content
vvk10839047
Participant
November 19, 2016
Question

In canvas saving a MovieClip capture and send to php

  • November 19, 2016
  • 2 replies
  • 1150 views

Need in HTML 5 capture image from MovieClip and send to php(for saving on server)

    This topic has been closed for replies.

    2 replies

    vvk10839047
    Participant
    November 21, 2016

    Thank you!

    Colin Holgate
    Inspiring
    November 19, 2016

    You can get the image data from the context of the canvas. Like this:

    var w = 400;//width of movieclip

    var h = 300;//height of movieclip

    var l = 100;//left of movieclip

    var t = 50;//top of movieclip

    var ctx = canvas.getContext('2d');

    var imagedata = ctx.getImageData(l,t,w,h));

    Legend
    November 20, 2016

    Sending raw image data sounds rather bandwidth-unfriendly. Note that you can have the browser convert canvas data to compressed image data for you automatically.

    HTMLCanvasElement.toDataURL() - Web APIs | MDN

    Colin Holgate
    Inspiring
    November 20, 2016

    Would that easily allow you to only send the area of a particular movieclip. or would you expect server side code to do that extraction?