Sathapanic Sriprom
Sathapanic Sriprom

Reputation: 365

Is it possible to capture screen from client side and store it to server side ? (PHP)

I'm now trying to do the screen capture at client side. Since I've used "imagegrabscreen()" function. I've found that it can capture screen on server side only. I try to find the new function and found that only capture screen at client side but store it on client as well. I got some temporary idea that I will use screen capture at client side and use javascript to call the ftp function via batch and transfer those image files to a centralized server. (There need to keep all screen capture files in the same place.)

If any idea please advise.

Thanks in advance

Upvotes: 0

Views: 4779

Answers (2)

Ruan Mendes
Ruan Mendes

Reputation: 92304

If you are OK with Firefox, see this answer: take screen shot using only js in firefox extension

<canvas id='my-canvas'></canvas>
<script> 
var canvas = document.getElementById('my-canvas');
var ctx = canvas.getContext("2D");
// Draw the window at the top left of canvas, width=100, height=200, white background
ctx.drawWindow(window, 0,0, 100, 200, "rgb(255,255,255)");
// Open another window with the thumbnail as an image
open(canvas.toDataURL("image/png"));
</script>

Your canvas will contain a screenshot of the window and you can easily sent that image to the server using Ajax since the call to canvas.toDataUrl() returns the Base64 encoded image.

This feature is only available for code running with Chrome privileges https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas#Rendering_Web_Content_Into_A_Canvas

Here's why http://mxr.mozilla.org/mozilla/source/content/canvas/src/nsCanvasRenderingContext2D.cpp#2352

Upvotes: 0

Marcus Adams
Marcus Adams

Reputation: 53870

This is not possible using any of the technologies that you describe, unless by JavaScript you mean calling some ActiveX, Browser Plugin, Java, or some real executable code that you've installed on the client machine.

You need to first install something on the client machine that integrates into the user's web browser and provides an interface through JavaScript.

Upvotes: 1

Related Questions