截取当前屏幕的屏幕截图,并通过php将其另存为png图像 [英] take a screenshot of the current screen and save it as a png image through php

查看:119
本文介绍了截取当前屏幕的屏幕截图,并通过php将其另存为png图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个要求,即客户单击"sceencapture"按钮时,他们需要当前网页的屏幕截图 虽然我用谷歌搜索 结果就是这样

Hello all I have an requirement that clients needs screenshot of current webpage when he clicks a button "sceencapture" Although i googled for it result come out in this way

$im = imagegrabscreen();
imagepng($im, "myscreenshot.png");
imagedestroy($im);

在php.net手册中的链接此处 注意:此功能仅在Windows上可用. 请帮助..

in the manual on php.net link here having a note :This function is only available on Windows. please help ..

推荐答案

使用PHP不可能做到这一点,因为PHP在服务器上执行,并且必须按照定义在客户端上截屏.您可以使用客户端技术(例如 html2canvas 库)在客户端截屏.然后,您可以根据需要将屏幕截图发送到服务器端PHP代码.

This is not possible using PHP, as PHP executes on the server and a screenshot by definition must be done on the client. You could take a screenshot on the client side using client-side technology like the html2canvas library. Then you could send the screenshot to your server side PHP code if you wanted to.

这篇关于截取当前屏幕的屏幕截图,并通过php将其另存为png图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆