Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top