是否可以从客户端捕获屏幕并将其存储到服务器端?(PHP)


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

我现在正尝试在客户端进行屏幕捕获。由于我使用了"imagegrabscreen()"函数。我发现它只能在服务器端捕获屏幕。我试图找到新的功能,发现它只在客户端捕获屏幕,但也将其存储在客户端上。我有一个临时的想法,我将在客户端使用屏幕捕获,并使用javascript通过批处理调用ftp函数,并将这些图像文件传输到集中服务器。(需要将所有屏幕捕获文件保存在同一个位置。)

如果有任何想法,请告知。

提前感谢

使用您所描述的任何技术都不可能做到这一点,除非JavaScript指的是调用一些ActiveX、浏览器插件、Java或您在客户端机器上安装的一些真正的可执行代码。

您需要首先在客户端机器上安装一些集成到用户的web浏览器中并通过JavaScript提供界面的东西。

如果您对Firefox满意,请参阅以下答案:在Firefox扩展中仅使用js进行屏幕截图

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

您的画布将包含窗口的屏幕截图,您可以使用Ajax轻松地将该图像发送到服务器,因为对canvas.toDataUrl()的调用返回Base64编码的图像。

此功能仅适用于使用Chrome权限运行的代码https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas#Rendering_Web_Content_Into_A_Canvas

原因如下http://mxr.mozilla.org/mozilla/source/content/canvas/src/nsCanvasRenderingContext2D.cpp#2352