Is there any possible cacth a web screenshot in virtual server hosting with PHP?

StackOverflow https://stackoverflow.com/questions/4808100

  •  24-10-2019
  •  | 
  •  

문제

I want catch web screenshots with PHP. Because I also need some process with PHP, I do not want use any on-line screenshot service. I am willing to renting a free hosting or a virtual server hosting which cost less than 20 dollars per year.

As I know, virtual server can not upload exe files (like url2bmp.exe, webshot.exe, webscreencapture.exe, etc). And they all use linux system (it can not use new COM("InternetExplorer.Application")).

So, is there any possible cacth a web screenshot in virtual server with PHP? Thanks.

도움이 되었습니까?

해결책

You can do this with Linux, it is seriously tricky though. You need FireFox, imagmagik and VNC installed.

Basically you get Firefox to open a new window in a VNC display, grab the screenshot of that display with imagmagik and then save it as a thumbnail. The hard part about this is getting the VNC portion to work, especially with a headless setup. But it is completely do-able.

However, it will probably be a ton easier just getting a Windows VPS.

Doing a search, found this which might work:

Taking website screenshot, server-side, on a Linux rented server, free

Ah and here is the post about what I described above:

Command line program to create website screenshots (on Linux)

다른 팁

as a possible alternative, you can check out this project: http://code.google.com/p/wkhtmltopdf/

You can take automated screenshots of websites using an open-source tool like pageres. It can also simulate various resolutions, testing responsive layouts.

I'm not sure whether it's relevant that your website is coded in PHP, or that you're mentioning .exe files. Are you new to web development?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top