有这么多直接和间接的方式来实现这一点
>使用HTML Canvas:http://html2canvas.hertzen.com/
>使用wkhtmltoimage
例
exec('wkhtmltoimage --quality 50 http://www.bbc.com bbc.jpg');
>使用wkhtmltopdf ImageMagic
– 使用wkhtmltopdf将网页转换为pdf
– 使用ImageMagic将pdf转换为jpg
例
exec("convert a.pdf a.jpg");
例
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://localhost");
/* Still working? */
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
header("Content-Type: image/png");
imagepng($im);
imagedestroy($im);
先进的例子
>使用Webshort,如果你安装了python,使用exec调用它
例
exec("python webshot.py https://example.com/webshot/php example.png");
例
webthumb.php?url=http://www.google.com&x=150&y=150
例
exec('boxcutter -f image.png');
>使用GrabzIt捕获PHP中的截图
例
$grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");
$id = $grabzIt->TakePicture("http://www.google.com", "http://www.example.com/GrabzItHandler.php");
使用此当前页面的示例
http://wimg.ca/https://stackoverflow.com/questions/10328457/how-to-export-the-whole-page-or-html-content-with-highcharts-not-just-the-chart/10330701#10330701
例
timthumb.php?src=http://www.google.com/&webshot=1
我认为已经给出了足够的例子