有很多直接和间接的方式来实现这一点
例子
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);
高级示例
-- 另见Get Website Screenshots Using PHP
对于可能的问题:Getting imagegrabscreen to work
例子
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 = 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
我认为已经给出了足够多的例子