我的服务器上的网站屏幕截图取决于用户

发布于 2024-10-14 10:16:13 字数 596 浏览 5 评论 0原文

我遇到了很多类似的问题,但我找不到简单的答案。我的目标是在我的服务器上为特定用户创建网页缩略图(取决于SESSION)。网站是动态的,每个不同的用户内容都会发生变化,就像Facebook上的用户内容一样。

我在这里需要做的是,当用户遇到应用程序问题时生成屏幕截图,然后单击捕获按钮

在此处输入图像描述

我有很多选项,例如

  • libwkhtmltox
  • wkhtmltopdf

但没有得到我应该使用的选项,也建议其他更好的选项。

我有linux服务器并使用核心PHP并且可以通过shell访问它。

请不要引用外部网站,因为在我的情况下他们无法获取快照(正如我所说的SESSION变量是为每个用户维护的)。

请帮助我完成教程。

提前致谢

I came upon many similar questions like this but I could not find simple answer. My goal is to create my web page thumbnail onto my server for a particular User (depending on SESSION). Website is dynamic means for every different user content changes like that contents of users on facebook.

What I need to do here is generate a screenshot when user experiences a problem with the application and click the capture button

enter image description here

I got many options like

  • libwkhtmltox
  • wkhtmltopdf

but not getting which I should use also suggest other if better.

I have linux server and using core PHP and have shell access to it.

Please don't refer external site as they are unable to get snapshot in my case (as I said SESSION variable is maintained for every user).

Please help me with the tutorial.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

污味仙女 2024-10-21 10:16:13

libwkhtmltoxwkhtmltopdf 都是捕获网页图像的出色技术。然而,问题在于,让这些技术与您的用户拥有相同的会话是非常困难的,即使不是不可能。此外,用户遇到的许多错误在第二次请求时无法重现。 (由数据库连接错误、缓存等引起的错误)所以这样做的价值有限。一种替代方法是在他们单击发送错误页面快照时抛出一个弹出窗口,解释如何截取屏幕截图。

如果你绝对想走这条自动化屏幕截图的道路,这里有一个疯狂的、可能是愚蠢的、不安全的想法。由于 wkhtmltopdf 是基于 webkit 构建的,因此有设置 cookie 的选项。只要您的 php session 是基于 cookie 的,您就可以将用户的 session_id 传递给 wkhtmltopdf,并劫持您自己的用户会话,从而重新创建当 wkhtmltopdf 发出请求时的页面。我因为建议这个而被否决了......

libwkhtmltox and wkhtmltopdf are both great technologies for capturing images of web pages. However, the problem is that it's really hard to get these technologies to have the same session as your user, if not impossible. Additionally, many errors users experience aren't reproducible on a second request. (Errors caused by db connection errors, caching, etc.) So doing something like this will have limited value. One alternative would be to throw a popup when they click your send errorpage snap that explains how to take a screenshot.

If you absolutely want to go down this path of automating the screenshot, here's a crazy, probably stupidly insecure idea. As wkhtmltopdf is built on webkit, there are options to set cookies. As long as your php session is cookie based, you could pass the user's session_id to wkhtmltopdf, and hijack your own user's session, thereby recreating the page when wkhtmltopdf makes the request. I'm so getting downvoted for suggesting this...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文