最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Screen Grab with PHP andor Javascript? - Stack Overflow

programmeradmin4浏览0评论

Just wondering if it's possible to screen grab a page you are viewing with a PHP script or javascript? For example, load up a page in an iframe and then save that view as a JPEG?

I'm sure it's possible somehow, but are there any known implementations/libraries that help out?

Just wondering if it's possible to screen grab a page you are viewing with a PHP script or javascript? For example, load up a page in an iframe and then save that view as a JPEG?

I'm sure it's possible somehow, but are there any known implementations/libraries that help out?

Share Improve this question asked Oct 10, 2008 at 22:18 AndreLiemAndreLiem 2,0515 gold badges20 silver badges27 bronze badges 1
  • there was a similar question – Gene T Commented Oct 11, 2008 at 0:20
Add a ment  | 

6 Answers 6

Reset to default 5

Nope, sorry, it is impossible with Javascript and definitely impossible with a server-side language like PHP. (Edit: I mean it's impossible to take a screenshot of the user's view of the page.)

It depends on what you want to do this for, but you might want to find a script or program that runs server-side and renders the webpage there. But if you really want to take the screenshot of the user's view of the page, it's pretty much impossible.

http://html2canvas.hertzen./ might do the trick.

There is a python tool called Webkit2png, hope it helps. But in PHP, i don't believe its possible

You can't do it in JS but you could do something similiar server side if you know the url of the page you want to convert to an image.

Tools like khtml2png could be called from php to render the page.

Possible with the GD2 extension and some knowledge of the internals you are capturing - read here for an example.

Thanks for the help guys. I did find this interesting resource:

http://www.zubrag./scripts/website-thumbnail-generator.php

It's not PHP specific by any means, just an example of running an EXE script that is called by PHP. Needs a windows server I believe though.

发布评论

评论列表(0)

  1. 暂无评论